0
controller.js 액세스 할 수 없습니다 :이온, 공장 및 서비스
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");
}]);
내가 컨트롤러 위에 실행하려고 할 때마다
, services.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();
}
});
})