2017-01-11 124 views
1

我是新來的離子和這是我廠的文件中的代碼

.factory('getLocations', ['$resource', 'constants', function ($resource,  constants) { 
return $resource(constants.server + constants.routes.getLocation, {id : '@id'}); 
    }]) 

這裏的網址是像../rest/search/:id

,並從控制器呼叫如下:

$scope.locations = getLocations.get({id : '1'}); 

但後來我打電話其餘URL,我得到下面的錯誤在我的控制檯:

ionic.bundle.js:26799 TypeError: V is not a function 
at http://localhost:8100/lib/angular-resource/angular-resource.min.js:13:165 
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13704:18) 
at C.setUrlParams (http://localhost:8100/lib/angular-resource/angular-  resource.min.js:13:50) 
at Function.l.(anonymous function) [as get (http://localhost:8100/lib/angular-resource/angular-resource.min.js:10:156) 
at Scope.$scope.loadLocations (http://localhost:8100/js/searchController.js:80:39) 
at fn (eval at compile (http://localhost:8100/lib/ionic/js/ionic.bundle.js:27643:15),<anonymous>:4:230) 
at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:30400:28) 
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:37225:13 
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:39989:9 
at forEach (http://localhost:8100/lib/ionic/js/ionic.bundle.js:13696:20) 
(anonymous) @ ionic.bundle.js:26799 
(anonymous) @ ionic.bundle.js:23512 
(anonymous) @ ionic.bundle.js:39991 

我缺少什麼?我正在傳遞url中定義的參數,但仍顯示此錯誤。請幫忙。

回答

0

我能解決這個問題。這是我配置我的工廠文件的一個問題。

+0

你能添加更多的信息,你的答案 – Kondal