由于在AngularJS中无法实例化模块应用程序? [英] Failed to instantiate module app due to in AngularJS?

查看:58
本文介绍了由于在AngularJS中无法实例化模块应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作AngularJS应用,但出现此错误:

I am trying to make an AngularJS app .But I am getting this error:

由于无法实例化模块应用

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>

推荐答案

工作正常,只需关闭脚本引用,如下所示:

It works fine, just close your script reference as follows:

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

<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>

这篇关于由于在AngularJS中无法实例化模块应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆