0

controller.js:Ionic, Fabriken und Dienstleistungen in service.js definiert ist nicht zugänglich

angular.module('app.controllers', []) 


.controller('mobileCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams) { 
    $scope.user = {} ; 

    $scope.sendSMS = function(){ 
    console.log("Test L1"); 
    console.log($scope.user.mobile); 
    var vCode = Math.floor(Math.random()*90000) + 10000; 
    var mobile = $scope.user.mobile; 
    var a = Calculator.square($scope.user.mobile); 
    Console.log("Calculate return "+ a); 

    SendSMSFactory.connectSMSGateway($mobile,$vCode).success(function(){ 

     console.log("Success"); 
     //assign value 
}).error(function(){ 
}) 
}; 


}]) 

.controller('signupCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams) { 


}]) 

.controller('eventCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams) { 


}]) 

.controller('verificationCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams) { 


}]) 

.controller('interestCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller 
// You can include any angular dependencies as parameters for this function 
// TIP: Access Route Parameters for your page via $stateParams.parameterName 
function ($scope, $stateParams) { 


}]) 

============

services.js

=======

angular.module('app.services', []) 

.factory('BlankFactory', [function(){ 

}]) 

.factory('SendSMSFactory', [function($http){ 
     return { 
    connectSMSGateway: function($mobileNumber,$vCode){ 
     console.log($mobileNumber); 
     console.log($vCode); 
     return $http.get('http://google.com'); 
    } 
    }; 

}]) 

.service('Calculator', function() { 
    this.square = function (a) { return a*a}; 

}) 

.service('BlankService', [function(){ 
     console.log("Blank Service"); 

}]); 

Jedes Mal, wenn ich versuche, über Controller zu laufen, ist es nicht in der Lage jede Methode in services.js sei es Fabrik oder einer Dienstleistung definiert zu finden. Es wirft Rechner ist kein Fehler definiert.

Ich weiß, ich vermisse sehr grundlegende Sache, aber nicht in der Lage, es herauszufinden.

Bitte helfen.

============== app.js

// Ionic Starter App 

// angular.module is a global place for creating, registering and retrieving Angular modules 
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) 
// the 2nd parameter is an array of 'requires' 
// 'starter.services' is found in services.js 
// 'starter.controllers' is found in controllers.js 
angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.directives','app.services']) 

.run(function($ionicPlatform) { 
    $ionicPlatform.ready(function() { 
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard 
    // for form inputs) 
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
     cordova.plugins.Keyboard.disableScroll(true); 
    } 
    if (window.StatusBar) { 
     // org.apache.cordova.statusbar required 
     StatusBar.styleDefault(); 
    } 
    }); 
}) 

Antwort

0

Ausgabe wurde, war ich die Servicenamen oder Fabriknamen in der Steuerung nicht vorbei. anstelle der Funktion ($ scope, $ stateParams), sollte es Funktion sein ($ scope, $ stateParams, Rechner, SendSMSFactory)

Verwandte Themen