Angularjs 参数';控制器';不是函数,未定义
我一直在研究这个问题,我发现一定是语法错误。由于我是Angular的新手,我已经尝试了很长一段时间来定位错误,但没有成功 如果有人能帮助我,我会非常感激,或者,如果是我做错了什么:Angularjs 参数';控制器';不是函数,未定义,angularjs,syntax,controller,ionic,Angularjs,Syntax,Controller,Ionic,我一直在研究这个问题,我发现一定是语法错误。由于我是Angular的新手,我已经尝试了很长一段时间来定位错误,但没有成功 如果有人能帮助我,我会非常感激,或者,如果是我做错了什么: angular.module('app-praiana', ['ionic', 'ngCordova']) .run(function ($ionicPlatform) { $ionicPlatform.ready(function () { // Hide the
angular.module('app-praiana', ['ionic', 'ngCordova'])
.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.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}])
.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/inicio');
$stateProvider.state('inicio-state', {
url: '/inicio',
views: {
'inicio': {
templateUrl: 'templates/home.html',
}
}
})
$stateProvider.state('termos-state', {
url: '/termos',
views: {
'termos': {
templateUrl: 'templates/termos.html'
}
}
})
});
angular.module('app-praiana.controllers', [])
.controller('InicioController', function($scope){
alert(1);
});
编辑:
错误发生在第一眼,就是这样:
错误:[ng:areq]参数“InicioController”不是函数,未定义
at REGEX_STRING_REGEXP(ionic.bundle.js:7888)
在assertArg(ionic.bundle.js:9389)
at assertArgFn(ionic.bundle.js:9399)
在爱奥尼亚束js:16224
在爱奥尼亚束js:15401
在forEach(ionic.bundle.js:8155)
在nodeLinkFn(ionic.bundle.js:15388)
at compositeLinkFn(ionic.bundle.js:14887)
在nodeLinkFn(ionic.bundle.js:15526)
在CompositeLink(ionic.bundle.js:14887)您的模块
app praiana
需要访问app praiana.controllers
模块才能使用其initioController
首先定义控制器模块,然后声明主模块,请执行以下操作:
angular.module('app-praiana', ['ionic', 'ngCordova', 'app-praiana.controllers'])
顺便说一句,我的ng应用程序atribute是我的HTML中的应用程序praiana。请给出完整的错误消息以及发生的时间/地点。我会从只调用一个
config
调用开始,而不是两个,合并它们