Ng areq Argument 'is not a function, got undefined
the code works without errors in chrome. but when i run it on android device and click the routing tab it will make an error. when?
error information: Error: [ng: areq] Argument "ChartController" is not a function, got undefined
index.html module defines
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>NursingManagement</title>
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<meta name="format-detection" content="telephone=no">
<!-- inject:app-styles:css --><!-- endinject -->
</head>
<body ng-app="NursingManagement">
<ion-nav-view></ion-nav-view>
<!-- inject:vendor:js --><!-- endinject -->
<!-- inject:app:js --><!-- endinject -->
<script src="cordova.js"></script>
</body>
</html>
App.js route config
angular.module('NursingManagement', ['ionic', 'ngCordova', 'ngResource'])
.config(['$httpProvider', '$stateProvider', '$urlRouterProvider','$ionicConfigProvider',function($httpProvider, $stateProvider, $urlRouterProvider,$ionicConfigProvider) {
$ionicConfigProvider.platform.android.tabs.position('bottom');
// register $http interceptors, if any. e.g.
// $httpProvider.interceptors.push('interceptor-name');
// Application routing
$stateProvider
.state('main', {
url: '/main',
abstract: false,
templateUrl: 'templates/main.html'
})
.state('main.message',{
url:'/message',
views:{
'myContainer':{
templateUrl:'templates/views/message.html',
controller:'MsgListController'
}
}
})
.state('main.chart',{
url:'/chart',
cache:false,
views:{
'myContainer':{
templateUrl:'templates/views/chart.html',
controller:'ChartController'
}
}
})
.state('main.compose',{
url:'/compose',
views:{
'myContainer':{
templateUrl:'templates/views/compose.html',
controller:'ComposeController'
}
}
})
// redirects to default route for undefined routes
$urlRouterProvider.otherwise('/main/message');
}]);
define controller
angular.module('NursingManagement')
.controller('ChartController', ['$scope','$ionicPlatform', '$cordovaSQLite',function($scope,$ionicPlatform, $cordovaSQLite) {
$scope.showChartType='line';
}
])
+3
source to share
No one has answered this question yet
Check out similar questions: