Hello,
I'm trying to make a tutorial to use Angular with a Drupal backend.
For that, Drupal provide JSON data and i try to use it with AngularJS. I've
decided to work with the Angular-phonecat tutorial.
Here is the JSON code provided by Drupal 7 for a phone detail (the list is
working fine) :
[{"node_title":"Dell Streak 7","description":"Introducing Dell\u2122 Streak 7.
Share photos, videos and movies together. It\u2019s small enough to carry
around, big enough to gather around. Android\u2122 2.2-based tablet with
over-the-air upgrade capability for future OS releases. A vibrant 7-inch,
multitouch display with full Adobe\u00ae Flash 10.1 pre-installed. Includes a
1.3 MP front-facing camera for face-to-face chats on popular services such as
Qik or Skype. 16 GB of internal storage, plus Wi-Fi, Bluetooth and built-in GPS
keeps you in touch with the world around you. Connect on your terms. Save with
2-year contract or flexibility with prepaid pay-as-you-go plans"}]
And i've this error :
Error: [$resource:badcfg] Error in resource configuration. Expected
response to contain an object but got an array
I've nearly the same code as in the angular tutorial (services.js) :
'use strict';
/* Services */
var phonecatServices = angular.module('phonecatServices', ['ngResource',
'ngSanitize']);
phonecatServices.factory('Phone', ['$resource',
function($resource){
return
$resource('http://ng-drupal.tld/drupal/phone-list/views/phone.json?args[0]=:phoneId',
{}, {
query: {method:'GET', params:{phoneId:'phones'}, isArray:true}
});
}]);
phonecatServices.factory('Phones', ['$resource',
function($resource){
return
$resource('http://ng-drupal.tld/drupal/phone-list/views/phone_list.json',
{}, {
query: {method:'GET', isArray:true}
});
}]);
I've changes the option isArray:true but the error is the same.
Any suggestions ?
PS : Sorry for my poor english, feel free to correct me...
--
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/groups/opt_out.