TypeError:r.details不是函数

时间:2015-09-19 01:58:18

标签: angularjs angularjs-service

我正在向工厂打电话时遇到一个奇怪的问题,我正在填写表格。我收到错误“TypeError:r.details不是函数”。我在另一个调用另一个服务的方法中设置完全相同的语法设置。我仔细查看了一下是否有拼写错误,但一切看起来都不错。

我的模块:

var app = angular.module('acnApp', ['ngResource', 'ngRoute'])

我的控制器:

app.controller('orgUpdateController', ['$scope', '$location', '$routeParams', 'orgFactory', function ($scope, $location, $routeParams, orgFactory) {

//MY CALL. I KNOW THE PARAM IS BEING PASSED AND HAVE CONSOLE.LOGGED IT

$scope.selectedOrg = orgFactory.details({ id: $routeParams.orgId }); }]);

我的工厂:

app.factory('orgFactory', ['$resource','domain', function ($resource,domain) {
return $resource(domain + '/api/networkorg/:id', {}, {
    details: { method: 'GET', params: { id: '@id' }}
});

}]);

在Chrome中运行并在控制台中查看,我收到错误:

TypeError: r.details is not a function
at new <anonymous> (http://localhost:55075/App/angularbundle.min.js:1:3928)
at e (http://localhost:55075/Scripts/angular.min.js:39:96)
at Object.g.instantiate (http://localhost:55075/Scripts/angular.min.js:39:213)
at b.$get (http://localhost:55075/Scripts/angular.min.js:80:257)
at g.link (http://localhost:55075/Scripts/angular-route.min.js:7:268)
at $ (http://localhost:55075/Scripts/angular.min.js:73:46)
at K (http://localhost:55075/Scripts/angular.min.js:61:495)
at g (http://localhost:55075/Scripts/angular.min.js:54:326)
at http://localhost:55075/Scripts/angular.min.js:53:388
at a.$get.h (http://localhost:55075/Scripts/angular.min.js:55:311) <div ng-view="" class="ng-scope">

如果有人看错了,我会很感激的!

感谢。

0 个答案:

没有答案