2017-08-17 76 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

相關問題