javascript - Can't get array by $resource -


can't array $resource. can me? when use $http well

i have error in console:

typeerror: undefined not function @ http://127.0.0.1:9000/bower_components/angular-resource/angular-resource.js:597:29 @ foreach (http://127.0.0.1:9000/bower_components/angular/angular.js:327:18) @ angular.module.provider.$get.resource.(anonymous function).$http.then.value.$resolved (http://127.0.0.1:9000/bower_components/angular-resource/angular-resource.js:595:19) @ deferred.promise.then.wrappedcallback (http://127.0.0.1:9000/bower_components/angular/angular.js:11616:81) @ http://127.0.0.1:9000/bower_components/angular/angular.js:11702:26 @ scope.$get.scope.$eval (http://127.0.0.1:9000/bower_components/angular/angular.js:12797:28) @ scope.$get.scope.$digest (http://127.0.0.1:9000/bower_components/angular/angular.js:12609:31) @ scope.$get.scope.$apply (http://127.0.0.1:9000/bower_components/angular/angular.js:12901:24) @ done (http://127.0.0.1:9000/bower_components/angular/angular.js:8487:45) @ completerequest (http://127.0.0.1:9000/bower_components/angular/angular.js:8703:7) 

i created factory method

coeffsresource.factory("coeffsresources",['$resource',   function($resource) {   return $resource('/api/:action',{}, {     get_all_coeffs: { method:'get', isarray:false, params: {action: 'getallregioncoefficients'} },     save_all_coeffs: { method:'post', params: {action: 'storeallregioncoefficients'} },     get_manufacturer: { method: 'get', isarray:true, params: {action: 'getallmanufacturers'} },     get_models: { method: 'get', params: {action: 'getmodels'} },     get_classes: {method: 'get', params: {action: 'getclassesconfig'} },     get_regions: {method: 'get', params: {action: 'getallregions'} },     get_ages_config: {method: 'get', params: {action: 'getagesconfig'} },     get_odometer: {method: 'get', params: {action: 'getodometersconfig'} },     get_tax_config: {method: 'get', params: {action: 'gettaxconfig'} }   }, {striptrailingslashes: false}) }]); 

include factory in controller

angular.module('etachkaevaluatorfrontendapp')   .controller('coeffctrl', function($scope,  $http, $resource, $q, coeffsresources) {        var coeffsresourcesobject =  new coeffsresources();       coeffsresourcesobject.$get_manufacturer().then(function() {        }, function() {        }) }) 

i think need inject ngresource dependency.

angular.module('etachkaevaluatorfrontendapp', ['ngresource']) 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -