2015-07-28 48 views
0

我一直在做一个Angular.js的课程,现在我完成了它,我想给它一个尝试并做一些测试。使用Angular.js的错误

我用于开始基本的html文件:

<html ng-app="app.js"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    <script src="plugins/angular-min-1.4.3.js"></script> 
    </head> 
    <body> 
    </body> 
</html> 

...指向简单的角度app.js主模块声明:

var app = angular.module('app', []); 

任何异常,不是吗?我尝试了一些指令,但是没有成功。然后,我发现这个错误,只要我只有上面的代码就会出现。我想这不是很好的添加插件,或者我没有很好地声明应用程序变量。

12:32:44.547 Error: [$injector:modulerr] http://errors.angularjs.org/1.4.3/ $injector/modulerr?p0=app.js&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.3%2F%24injector%2Fnomod%3Fp0%3Dapp.js%0AJ%2F%3C%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A6%3A416%0Ade%2F%3C%2F%3C%2F%3C%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A24%3A66%0Aa%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A23%3A109%0Ade%2F%3C%2F%3C%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A23%3A1%0Ag%2F%3C%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A37%3A381%0Am%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A7%3A320%0Ag%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A37%3A229%0Aeb%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A40%3A1%0AAc%2Fd%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A19%3A339%0AAc%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A20%3A151%0AZd%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A18%3A464%0A%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A289%3A428%0Aa%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A176%3A73%0AGf%2Fc%40http%3A%2F%2Flocalhost%2FAngularPruebas%2Fplugins%2Fangular-min-1.4.3.js%3A35%3A212%0A1 angular-min-1.4.3.js:6:415

这是为什么发生?

+0

该模块是app不是app.js.另外,请尝试包括Angular.js的非微软版本 - 它会给你更多的信息错误。 – pixelbits

回答

1

好吧,我真的很傻,没有添加app.js文件。现在我添加了它,ng-app =“app”找到了它。

0

在ng-app上,你必须说出应用程序的名称,在这种情况下它是“app”而不是文件。我建议你也不要在HTML标签上使用ng-app。

3

在html中有错误。
您的应用程序是应用程序,而不是app.js

<html ng-app="app"> 
    <head> 
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
     <script src="plugins/angular-min-1.4.3.js"></script> 
    </head> 
    <body></body> 
</html> 
+0

它仍然显示相同的错误。没有任何变化。 – Zerok

+0

尝试使用未缩小版本的角度。错误信息会变得更清晰。 – pasine

+0

顺便说一句,如果你得到完全相同的错误,这意味着你没有改变HTML,因为错误提到'app.js'这只是在你的HTML。 – pasine

相关问题