2015-02-10 83 views
2

我正在計劃用我的應用實現角度材料設計。我已經包括了material.js和material.css和應用程序定義去如下, 這裏是代碼,帶angularJS應用的角度材料

的Index.html:

<script src="js/ripples.js"></script> 
<script src="js/material.js"></script> 

app.js AR routerApp = angular.module('DiginRt',['ui.bootstrap','SimpleCouch','ngMaterial']);

當我開始運行應用程序,它說

Uncaught Error: [$injector:modulerr] Failed to instantiate module DiginRt due to: 
Error: [$injector:modulerr] Failed to instantiate module ngMaterial due to: 
Error: [$injector:nomod] Module 'ngMaterial' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
+0

你在'material.js'之前或之後放置'angular.js'引用的地方? – Rebornix 2015-02-10 05:38:49

+0

在angular.js – Sajeetharan 2015-02-10 05:39:59

+0

之後,您最好創建一個jsfiddler/plnkr.co/codpen演示應用以更好地排除故障。 – Rebornix 2015-02-10 05:42:40

回答

6

我已經創建使用這種順序噴射角我的材質設計項目,希望它幫助,

<script src="bower_components/angular/angular.js"></script> 
    <script src="bower_components/angular-animate/angular-animate.js"></script> 
    <script src="bower_components/angular-route/angular-route.js"></script> 

    <script src="bower_components/angular-aria/angular-aria.js"></script> 
    <script src="bower_components/hammerjs/hammer.js"></script> 
    <script src="bower_components/angular-material/angular-material.js"></script> 
... 
    <script src="app.js"></script> 

順便說一句,你有沒有使用亭子安裝角材料--save安裝呢?

2

錯誤是說,它無法找到的依賴。很可能您將錯誤的順序包含在腳本中。確保最後包含app.js。沒有看到一個代碼示例,我不能再比這個更具體。正如@ rebornix所說,jsfiddle或Plunker會非常有幫助。

+0

它的工作時,我重新排序的JavaScript文件。 – Sajeetharan 2015-02-10 06:42:29