When I use *.query()* instead .get() on the resource I get an exception:

Error: [$resource:badcfg] Error in resource configuration. Expected 
response to contain an array but got an object
http://errors.angularjs.org/1.2.20/$resource/badcfg?p0=array&p1=object



On Saturday, August 9, 2014 6:03:02 PM UTC+2, Jesus Rodriguez wrote:
>
> Have you queried it? If you're using $resource, you have to .query() the 
> resource to get it.
>
> On Saturday, August 9, 2014 1:44:52 PM UTC+2, kacha haan wrote:
>>
>> Thanks Raul and Thomas.
>>
>> It still not works, though Foxandxss <http://plnkr.co/users/Foxandxss> 
>> brought 
>> me a step further when he hinted me about security and brought $sce to this 
>> issue here. See his Plunker example (including ng-view) 
>> <http://plnkr.co/edit/WQRPr7B6W04MmPrHgafQ?p=preview>. 
>>
>> I stuck now with JSON. From my Backend I get a simple JSON object:
>>
>> json = Resource {$promise: Object, $resolved: false, $get: function, 
>> $save: function, $query: function…}
>>          $promise: Object
>>          $resolved: true
>>          svg: "<svg height="30" width="200"><text x="0" y="15" 
>> fill="red">Hello World !</text></svg>"
>>          __proto__: Resource
>>
>> But when I try to extract the svg with *var jsonsvg = json.svg* I only 
>> get:
>>
>> jsonsvg = undefined
>>
>> Hence nothing to render. 
>>
>> Any idea why I can not access the svg ?
>>
>>
>> On Saturday, August 9, 2014 1:09:05 AM UTC+2, ThomasBurleson wrote:
>>>
>>> @Kacha,
>>>
>>> Apparently I was not thinking clearly in my original response:
>>>   <div class="ng-bind">
>>>       <svg height="30" width="200"><text x="0" y="15" fill="red">Hello 
>>> World !</text></svg>
>>>   </div>
>>> will not render the SVG. Nor will
>>>   <div ng-bind="">
>>>       <svg height="30" width="200"><text x="0" y="15" fill="red">Hello 
>>> World !</text></svg>
>>>   </div>
>>> But 
>>>   <div class="ng-binding">
>>>       <svg height="30" width="200"><text x="0" y="15" fill="red">Hello 
>>> World !</text></svg>
>>>   </div>
>>> should render just fine.
>>>
>>> So the ng-bind can be used as tag attribute or as a class type 
>>> class="ng-bind: 
>>> " ( if you use the :<value> suffix) 
>>> Angular inserts/appends the ng-binding value to the class when the 
>>> ng-bind directive is used to bind a scope value to the element content.
>>>
>>> Your original sample directly used (without ng-view) DOES render the 
>>> <svg ..>! See my Plunkr sample 
>>> <http://plnkr.co/edit/mKgRr6GUV82MJjHwBTgv?p=preview>
>>> Of course I have not tested with ng-view... does it still not work for 
>>> you ?
>>>
>>>
>>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to