2017-08-17 78 views
0

我试图让一个AngularJS应用程序。但我收到此错误:由于在AngularJS中实例化模块应用失败?

Failed to instantiate module app due to

这里是我的代码:

<html> 
<head><title>New Version!</title> 
</head> 
<body ng-app="app"> 
<div ng-controller="appcontr"> 
    <ul> 
     <li>A new XSLT engine is added: Saxon 9.5 EE, with a namecense (thank you Michael Kay!)</li> 
     <li>XSLT 3.0 support when using the new Saxon 9.5 EE engine!</li> 
     <li>Preview your result as HTML when doctype is set to HTML (see this example)</li> 
     <li>Preview your result as PDF when doctype is set to XML and your document starts with root element of XSL-FO. 
      Apache FOP is used to generate the PDF 
     </li> 
     <li>Added some namenks to useful XSLT sites</li> 
    </ul> 
</div> 
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"/> 


<script> 
    angular.module('app', []).controller('appcontr', appcontr) 
    function appcontr($scope) { 
     $scope.name = 'dd' 
    } 

</script> 

</body> 
</html> 
+0

你得到任何原因未能实例? –

+0

由于**什么**?错误消息包含有关错误的信息,并且在问题中省略。它可以通过做**来修复**。 – estus

+0

'未捕获的错误:[$ injector:modulerr]由于以下原因而无法实例化模块应用程序: 错误:[$ injector:nomod]模块'app'不可用!您拼错了模块名称或忘记加载模块名称。如果注册模块,请确保您指定依赖关系作为第二个参数。' – georgeawg

回答

0

它工作正常,只要闭上你的脚本参考如下:

<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"> 
</script> 

DEMO

angular.module('app', []).controller('appcontr', appcontr) 
 
    function appcontr($scope) { 
 
     $scope.name = 'dd' 
 
    }
<html> 
 
<head><title>New Version!</title> 
 
</head> 
 
<body ng-app="app"> 
 
<div ng-controller="appcontr"> 
 
<h1> {{name}}</h1> 
 
    <ul> 
 
     <li>A new XSLT engine is added: Saxon 9.5 EE, with a namecense (thank you Michael Kay!)</li> 
 
     <li>XSLT 3.0 support when using the new Saxon 9.5 EE engine!</li> 
 
     <li>Preview your result as HTML when doctype is set to HTML (see this example)</li> 
 
     <li>Preview your result as PDF when doctype is set to XML and your document starts with root element of XSL-FO. 
 
      Apache FOP is used to generate the PDF 
 
     </li> 
 
     <li>Added some namenks to useful XSLT sites</li> 
 
    </ul> 
 
</div> 
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.js"> 
 
</script> 
 
</body> 
 
</html>

+0

可以请给更多的信息,请提供plunker – user5711656

+0

哪些参考? – user5711656

+0

@ user5711656查看演示,其angular.js参考 – Sajeetharan

相关问题