ng areq Argument' '不是一个功能,未定义

时间:2015-05-27 05:49:06

标签: angularjs cordova

代码在chrome中没有错误。但是当我在Android设备上运行它并单击一个选项卡进行路由时,它将产生错误。什么时候?

错误信息:错误:[ng:areq]参数' ChartController'不是一个功能,未定义

index.html模块定义

<!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');
  }]);

定义控制器

 angular.module('NursingManagement')
    .controller('ChartController', ['$scope','$ionicPlatform', '$cordovaSQLite',function($scope,$ionicPlatform, $cordovaSQLite) {
      $scope.showChartType='line';
        }
    ])

0 个答案:

没有答案