0
したがって、角度とイオンが新しくなりました。私はエラーを取得するページを実行Ionic/Angular JSコントローラは機能を認識しません
.controller('weineCtrl', ['$scope', '$stateParams',function ($scope, $stateParams, serviceName) {
var test = serviceName.doStuff(3); }])
毎回:
angular.module('app.services', [])
.factory('serviceName', function() {
var z = 2;
return {
doStuff: function (x) {
return x * z;
},
doMoreStuff: function (y) {
return y * z;
}
}
})
今、私は私のコントローラのいずれかで機能doStuffを使用したい:
私Serives.jsファイルには、次のようになります:
TypeError: Cannot read property 'doStuff' of undefined
at new <anonymous> (controllers.js:21)
at Object.instantiate (ionic.bundle.js:18015)
at $controller (ionic.bundle.js:23417)
at Object.self.appendViewElement (ionic.bundle.js:59908)
at Object.render (ionic.bundle.js:57901)
at Object.init (ionic.bundle.js:57821)
at Object.self.render (ionic.bundle.js:59767)
at Object.self.register (ionic.bundle.js:59725)
at updateView (ionic.bundle.js:65400)
at ionic.bundle.js:65377
何が間違っていますか?
あなたは私のヒーロー、感謝です! –