i intend return few resource factory, unfortunately failed in case. shows error message entry not function scope.$scope.create.
this working code 1 resource:
angular.module('entry').factory('entry', function($resource) { return $resource('/api/entries/:id', { id: '@_id' }, { update: { method: 'put' } }); }); $scope.create = function() { var entry = new entry({ }); entry.$save(function() {}); }
this not working code after adding multiple resource:
angular.module('entry').factory('entry', function($resource) { return { 'entrya': $resource('/api/entries/:id', { id: '@_id' }, { update: { method: 'put' } }), 'entryb': $resource('/api/entries/:id', { id: '@_id' }, { update: { method: 'put' } }), }; }); $scope.create = function() { var entry = new entry({ }); entry.entrya.$save(function() {}); }
Comments
Post a Comment