0
離子和角的新手。離子廠undefined
我想開發一個測試應用程序,並試圖使用工廠功能。 我做了Ionic Creator的設計,並嘗試添加我的編碼。
下面是我的控制器文件。
angular.module('app.controllers', [])
.controller('loadingCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams, awesomeFactory) {
$scope.aa = awesomeFactory.GetUser();
}])
.controller('mainPageCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('historyCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('firstrunCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('resultsCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('doctorCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('bookingCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
.controller('appointmentCtrl', ['$scope', '$stateParams',
function ($scope, $stateParams) {
}])
下面是我的文件,有工廠。
angular.module('app.services', [])
.factory('BlankFactory', [function(){
}])
.service('BlankService', [function(){
}]
.factory('awesomeFactory', function($http) {
return {
GetUser: function() {
return $http.get("http addy return json object").then(function(response) {
//Process Stuff Here
return response;
});
},
}
})
);
我得到2個錯誤。 1.錯誤:awesomeFactory未定義。 2. TypeError :(中間值).factory不是函數[瞭解更多]
我只是不知道我在做什麼錯。可能有點小。 但非常感謝任何幫助。
預先感謝您。
嗨,它返回一個未知提供者錯誤。它說:未知的提供者:awesomeFactoryProvider < - awesomeFactory < - loadingCtrl –
現在只有一個錯誤??確保你已經在你的index.html中引用了js文件 –
現在只有一個錯誤。是的,參考在那裏。 –