Tuesday 15 March 2011

javascript - After update angular to 1.3, resource not working -



javascript - After update angular to 1.3, resource not working -

before update angular, code worked , dont have problems it, after update, have crash in line

homecoming $resource('/admin/:url/:id', null,

screen error - http://prntscr.com/51zomi

my service

class="snippet-code-js lang-js prettyprint-override">datapage.$inject = ['$resource']; function datapage ($resource) { homecoming $resource('/admin/:url/:id', null, { 'update': { method:'put' } }); }

i calling so

class="snippet-code-js lang-js prettyprint-override">$scope.pages = datapage.get({id:page.id, url:'sport_pages'}); $scope.pages.$promise['finally'](function(){ $scope.loading = false; });

but have error message.....

help me pls, how can prepare it?

updated!!

angular 1.3 more strong json parse. i'm have invalid json in response , angular display error.... thanks.

i'm not sure if it's issue angular 1.3, there possibility that:

null isn't valid specification of info used resource null sure isn't resource has parameters used in path

this works me:

without parameters

return $resource('api/groups', {}, {});

call:

groups.get();

with parameters (your case)

return $resource('messages/:lang/:packagename.json', {packagename: '@packagename', lang: '@lang'}, {});

call:

messages.get({ packagename: 'base', lang: $scope.lang });

i know looks redundant, works great.

edit: in sentiment error thrown while parsing path , encountering letter u after : char , not finding suitable parameter in sec parameter of $resource function, that's guess

javascript angularjs

No comments:

Post a Comment