Javascript 尝试在ionic上多次加载angular

Javascript 尝试在ionic上多次加载angular,javascript,angularjs,ionic-framework,Javascript,Angularjs,Ionic Framework,我用爱奥尼亚的路线做了个积垢。但是路由不起作用。当我运行这个项目时,它没有显示任何类似的内容。当我查看控制台时,有一个警告: 警告:尝试多次加载角度 有人能帮我吗 索引: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scal

我用爱奥尼亚的路线做了个积垢。但是路由不起作用。当我运行这个项目时,它没有显示任何类似的内容。当我查看控制台时,有一个警告:

警告:尝试多次加载角度

有人能帮我吗

索引:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link rel="manifest" href="manifest.json">
    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
  </head>
  <body ng-app="myAPP">
    <ion-pane>
      <ion-header-bar class="bar-stable">
      <div class="bar bar-header bar-calm">
        <h1 class="title" align="center">CRUD</h1>
      </div>
      <div class="tabs-striped tabs-top">
      <div class="tabs">
            <a class="tab-item" href="#/">List</a>
            <a class="tab-item" href="#/addData">Add Data</a>
            <a class="tab-item" href="#/editData">Edit Data</a>
      </div>
      </ion-header-bar>
      <ion-content>
      <div>
        <div ng-view></div>
      </div>    
      </ion-content>
    </ion-pane>
    <script src="js/angular.js"></script>
    <script src="js/angular-route.js"></script>
    <script src="js/app.js"></script>
    <script src="js/route.js"></script>
    <script src="controller/controller.js"></script>
    <script src="controller/edit.js"></script>
  </body>
</html>
route.js:

app.config(['$routeProvider',function($routeProvider){
    $routeProvider.

    when('/',{
        templateUrl : '../pages/list.html',
        controller : 'controller'
    })
    .when('/addData',{
        templateUrl : '../pages/addData.html',
        controller : 'controller'
    })
    .when('/editData/:id',{
        templateUrl : '../pages/update.html',
        controller : 'controllerEdit'
    })
    .otherwise({
        redirectTo : '/'
    });
}])
list.html:

<div class="container">
<h2>{{title}}</h2>
</br>
</br>
  <table class="table table-striped" ng-init="getData()">
    <tr>
      <th>NO</th>
      <th>Nama</th>
      <th>Alamat</th>
      <th>Action</th>
    </tr>
    <tr ng-repeat="x in dataList track by $index">
      <td>{{$index+1}}</td>
      <td>{{x.nama}}</td>
      <td>{{x.alamat}}</td>
      <td>
      <button type="button" class="btn btn-info" ng-click="edit(x.id)">Edit</button>
      <button type="button" class="btn btn-danger" ng-click="delete(x.id)">Delete</button>
      </td>
    </tr>
  </table>
</div>

{{title}}


不 纳米 阿拉马特 行动 {{$index+1}} {{x.nama}} {{x.alamat}} 编辑 删除
ionic.bundle.js是:

  • ionic.js
  • angular.js
  • angular-animate.js
  • angular-sanitize.js
  • angular-ui-router.js
  • ionic-angular.js
  • 并且你的app.js应该是

    var app = angular.module('ionicApp', [ 'ionic' ])
    
    app.config(function($stateProvider, $urlRouterProvider) {
    
        // Ionic uses AngularUI Router which uses the concept of states
        // Learn more here: https://github.com/angular-ui/ui-router
        // Set up the various states which the app can be in.
        // Each state's controller can be found in controllers.js
        $stateProvider
    
        // setup an abstract state for the tabs directive
        .state('tab', {
            url : "/tab",
            abstract : true,
            templateUrl : "templates/tabs.html",
            controller : 'dashboardCtrl'
        })
    
        // Each tab has its own nav history stack:
    
        .state('tab.overview', {
            url : '/overview',
            views : {
                'tab-overview' : {
                    templateUrl : 'templates/tab-overview.html',
                    //controller : 'overviewCtrl'
                }
            }
        })
    
        // if none of the above states are matched, use this as the fallback
        $urlRouterProvider.otherwise('/tab/overview');
    })
    

    ionic.bundle.js是下列内容的串联:

  • ionic.js
  • angular.js
  • angular-animate.js
  • angular-sanitize.js
  • angular-ui-router.js
  • ionic-angular.js
  • 并且你的app.js应该是

    var app = angular.module('ionicApp', [ 'ionic' ])
    
    app.config(function($stateProvider, $urlRouterProvider) {
    
        // Ionic uses AngularUI Router which uses the concept of states
        // Learn more here: https://github.com/angular-ui/ui-router
        // Set up the various states which the app can be in.
        // Each state's controller can be found in controllers.js
        $stateProvider
    
        // setup an abstract state for the tabs directive
        .state('tab', {
            url : "/tab",
            abstract : true,
            templateUrl : "templates/tabs.html",
            controller : 'dashboardCtrl'
        })
    
        // Each tab has its own nav history stack:
    
        .state('tab.overview', {
            url : '/overview',
            views : {
                'tab-overview' : {
                    templateUrl : 'templates/tab-overview.html',
                    //controller : 'overviewCtrl'
                }
            }
        })
    
        // if none of the above states are matched, use this as the fallback
        $urlRouterProvider.otherwise('/tab/overview');
    })
    

    首先,为什么要使用路由提供程序。事实上,爱奥尼亚正在使用状态提供程序…首先,为什么要使用路由提供程序。事实上,爱奥尼亚正在使用状态提供程序。。。