I try to use the $resource service with surveygizmo api.
My code :
html :
<div ng-app="Survey">
<body>
<div ng-controller="SurveyCtrl">
{{survey.data.title}}
</div>
</body>
</div>
my script :
angular.module('Survey', ['ngResource']);
function SurveyCtrl($scope, $resource) {
$scope.surveygizmo = $resource('https://restapi.surveygizmo.com/v3/survey/:id',
{id: '@id'},
{get:{method:'JSONP', params: {'user:pass':'xxx@xxxx:xxxx', q:'angularjs', callback:'JSON_CALLBACK'}, isArray:true}});
$scope.survey = $scope.surveygizmo.get({id:xxxx}, function(survey) {
alert('this is ok');
}, function(err){
alert('request failed');
});
}
When i try it, the alert 'request failed' appear in my page. No json result in the page but i can see it in the firebug network menu.
May i miss something?
kalaoke