2016-01-20 68 views
0

我知道這很簡單,但我一直在嘗試幾個小時,看不到它是什麼。這是我進口:`

<!-- ionic/angularjs js --> 
<script src="lib/ionic/js/ionic.bundle.js"></script> 
<meta charset="utf-8"> 
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
<title></title> 

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

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
<link href="css/ionic.app.css" rel="stylesheet"> 
--> 



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

<!-- your app's js --> 
<script src="js/app.js"></script> 

,這裏是應用程序文件的內容:

// Ionic Starter App 

// angular.module is a global place for creating, registering and retrieving Angular modules 
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html) 
// the 2nd parameter is an array of 'requires' 
// 'starter.services' is found in services.js 
// 'starter.controllers' is found in controllers.js 
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']) 

.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 && window.cordova.plugins.Keyboard) { 
     cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); 
     cordova.plugins.Keyboard.disableScroll(true); 

    } 
    if (window.StatusBar) { 
     // org.apache.cordova.statusbar required 
     StatusBar.styleDefault(); 
    } 
    }); 
}) 

.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' 
    }) 

    // Each tab has its own nav history stack: 

    .state('tab.dash', { 
    url: '/dash', 
    views: { 
     'tab-dash': { 
     templateUrl: 'templates/tab-dash.html', 
     controller: 'DashCtrl' 
     } 
    } 
    }) 

    .state('tab.chats', { 
     url: '/chats', 
     views: { 
     'tab-chats': { 
      templateUrl: 'templates/tab-chats.html', 
      controller: 'ChatsCtrl' 
     } 
     } 
    }) 
    .state('tab.chat-detail', { 
     url: '/chats/:chatId', 
     views: { 
     'tab-chats': { 
      templateUrl: 'templates/chat-detail.html', 
      controller: 'ChatDetailCtrl' 
     } 
     } 
    }) 

    .state('tab.account', { 
    url: '/account', 
    views: { 
     'tab-account': { 
     templateUrl: 'templates/tab-account.html', 
     controller: 'AccountCtrl' 
     } 
    } 
    }); 

    // if none of the above states are matched, use this as the fallback 
    $urlRouterProvider.otherwise('/tab/dash'); 

}); 

我還沒有碰到的app.js作爲尚未所以我不知道在哪裏特定錯誤來自

+0

我們可能需要看看你的'app.js'的內容,以便幫助我在那裏編輯 – Sean3z

+0

。正如我提到的,我甚至沒有觸及app.js文件,所以我不明白這個錯誤 –

回答

0

最終,當Angular無法實例化模塊時發生此錯誤。通常,這發生在存在問題或(可能在此情況下)缺少依賴關係時發生。

// 'starter.services' is found in services.js 
// 'starter.controllers' is found in controllers.js 
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services']) 

它看起來像starter模塊試圖注入starter.controllersstarter.services。但是,註釋中引用的腳本不會出現在HTML文件中。既然不似乎還是使用,你可以考慮刪除它們

angular.module('starter', ['ionic']) 

它也期待你試圖使用UI Router但是,它不是在你的HTML鏈接要麼 - 所以你要添加還有

<script src="js/angular-ui-router.min.js"></script> 
相關問題