I am using state provider in ng-app and in myCtrl1.js ,the error occurred likeエラー:[NG:AREQ]:[NG:AREQ]引数が 'myCtrl1' 関数ではありません、未定義
エラーまし引数 'をmyCtrl1' 関数ではありません、未定義だ、以下の私のコード..です
MainApp.js
'use strict';
var mainApp=angular.module('mainApp',['ui.router']);
angular.module('mainApp',['ui.router']).config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('Emergency Message', {
url: '/',
templateUrl:'msg/setting.html',
controller:'myCtrl1'/*This one generates an error which i have explained above..*/
})
.state('setting', {
url: '/setting',
templateUrl: 'setting/cchk.html',
controller:'myCtrl'/*this works*/
})
.state('message', {
url: '/message',
templateUrl: 'msg/setting.html',
controller:'myCtrl1'/*same This one also generates an error which i have explained above.. */
});
}]);
Below file in which error occurs
myCtrl1.js
'use strict';
angular.module('mainApp',[]).controller('myCtrl1',function($scope,$http){
});
Below is my index page
Index.html
This is my html page in and it has all the js,css and all file which are required.
<!DOCTYPE html>
<html ng-app="mainApp">
<head
これはあなたがこれを実行しなければならない代わりにangular.module('mainApp',[]),controller(...)
の
</head>
<body>
<center>
<a id="a1" ui-sref=".message">Message</a>
<a id="a2" ui-sref=".setting">Setting</a>
</center>
<br><br><br><br>
<div ui-view></div>
</body>
</html>
This all are the files please help me out...
これは、angular.module( 'mainApp')と同じようにコントローラを登録する必要があります。コントローラ(...)は、同様にangular.module( 'mainApp')を実行する必要があります。config – gaurav5430
myCtrlは、どの作品ですか?コントローラ( 'myCtrl'、function($ scope、$ http){}); – gaurav5430
angular.module( 'mainApp')。 –