警告:试图加载角度不止一次。 Angular JS问题

时间:2016-09-15 14:30:29

标签: javascript angularjs ionic-framework ng-messages

我有一个警告,试图多次加载角度,我解决它通过改变我的Index.html页面上的脚本标签的顺序,但问题是,当我构建app即使警告消失后它仍然无效!

这些是首先导致问题的脚本

<link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"/>
  <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-messages.js"></script>

我通过删除调用ionic.bundle.js的脚本并在调用所有脚本后放置其他脚本来解决此问题

 <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <meta http-equiv="Content-Security-Policy">




    <title></title>


    <!-- weather font -->
    <link href="css/weather-icons.min.css" rel="stylesheet">

    <!-- ionic gallery -->
    <link href="lib/ionic-gallery/css/ion-gallery.css" rel="stylesheet">

    <!-- compiled css output -->
    <link href="css/ionic.app.css" rel="stylesheet">

    <!-- style.css -->
    <link rel="stylesheet" href="css/style.css" />

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

    <!-- angular-nl2br js -->
    <script src="lib/angular-nl2br/angular-nl2br.min.js"></script> 

    <!-- ionic number picker -->
    <script src="lib/ionic-numberpicker/dist/ionic-numberpicker.bundle.min.js"></script>

    <!-- elastic js-->
    <script src="lib/angular-elastic/elastic.js"></script>

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

    <!-- google maps javascript -->
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB16sGmIekuGIvYOfNoW9T44377IU2d2Es&amp;sensor=true"></script>


    <!-- ionic gallery -->
    <script src="lib/ionic-gallery/js/ion-gallery.min.js"></script>

    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-messages.js"></script>
    <!-- your app's js -->
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
    <script src="js/services.js"></script>
  </head>
  <body ng-app="starter">

    <ion-side-menus>

      <!-- Center content -->
      <ion-side-menu-content>
        <ion-nav-bar class="bar-balanced" align-title="center">
          <!-- Back button -->
          <ion-nav-back-button>
            Back
          </ion-nav-back-button>

          <!-- Burger button -->
          <ion-nav-buttons side="left">
            <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
            </button>
          </ion-nav-buttons>

          <!-- Cart button -->
          <ion-nav-buttons side="right">
            <button class="button button-icon button-clear ion-android-more-vertical" ui-sref="home">
            </button>
          </ion-nav-buttons>
        </ion-nav-bar>

        <!-- Main view content -->
        <ion-nav-view animation="slide-left-right"></ion-nav-view>
      </ion-side-menu-content>

      <!-- Left menu -->
      <ion-side-menu side="left">
        <ion-content>

          <!-- User profile -->
          <div class="text-center">
            <a ui-sref="user({userId: 0})">
              <img class="profile-picture circle" menu-close="" src="img/thumb/adam.jpg">
              <h4>Adam Lambert</h4>
            </a>
          </div>

          <!-- Menu -->
          <div class="list" menu-close="">
            <div class="item item-icon-left" ui-sref="home">
              <i class="icon ion-ios-home-outline"></i>
              Home
            </div>

            <div class="item item-icon-left" ui-sref="nearby">
              <i class="icon ion-ios-location-outline"></i>
              Nearby
            </div>

            <div class="item item-icon-left" ui-sref="chats">
              <i class="icon ion-ios-email-outline"></i>
              Message
              <span class="badge badge-assertive">2</span>
            </div>
            <div class="item item-icon-left" ui-sref="ticket">
              <i class="icon ion-android-plane"></i>
              Flight booking
            </div>
            <div class="item item-icon-left" ui-sref="weather">
              <i class="icon ion-ios-cloud-outline"></i>
              Weather
            </div>
            <div class="item item-icon-left" ui-sref="gallery">
              <i class="icon ion-images"></i>
              Photos
            </div>
            <div class="item item-icon-left" ui-sref="friends">
              <i class="icon ion-ios-people-outline"></i>
              Friends
            </div>
            <div class="item item-icon-left" ui-sref="taxi">
              <i class="icon ion-model-s"></i>
              Taxi
            </div>
            <div class="item item-icon-left" ui-sref="shopping">
              <i class="icon ion-bag"></i>
              Shopping

            </div>
            <div class="item item-icon-left" ui-sref="currency">
              <i class="icon ion-card"></i>
              Currency
            </div>
            <div class="item item-icon-left" ui-sref="login">
              <i class="icon ion-log-out"></i>
              Logout
            </div>
          </div>

        </ion-content>

      </ion-side-menu>

    </ion-side-menus>

  </body>
</html>

随着这些更改警告消失,但应用程序仍无法在移动设备上运行!

0 个答案:

没有答案