HTA与角度相结合产生误差

时间:2015-12-19 09:41:08

标签: javascript angularjs hta

我制作了一个有效的angularjs HTML SPA。在特定情况下,我需要HTA的强大功能。据我所知,将HTA与angular或任何其他有效HTML结合使用没有任何限制。不过我在使用

行时遇到错误
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>  
HTA中的

,即使它是标题中唯一的脚本标记。

错误消息为:脚本错误,代码0,URL http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js

我希望其他人之前遇到过此错误,但我无法在stackoverflow上找到任何内容。有人认出这个问题吗?有解决方案或解决方法吗?

    <!DOCTYPE html>
    <html lang="en-US" ng-app="myApp" ng-controller="myCtrl">
      <head>
        <HTA:APPLICATION
      APPLICATIONNAME="my app"
      SINGLEINSTANCE="yes"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
        <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
        </head>
        <body>
            <div >   
            ...Do something
            </div> 
        </body>
    </html>

1 个答案:

答案 0 :(得分:2)

您已在HTML元素上声明ng-appng-controller,但未定义其处理程序。此外,如注释中所述,您必须提升隐式IE版本以使用带有X-UA-Compatible元的理智JS引擎。添加这两行修复了错误:

&#13;
&#13;
<!DOCTYPE html>
	<html lang="en-US" ng-app="myApp" ng-controller="myCtrl">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
		<HTA:APPLICATION
		APPLICATIONNAME="my app"
		SINGLEINSTANCE="yes"/>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
		<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
		<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.js"></script>
		<script>angular.module('myApp',[]).controller('myCtrl',['$scope',function($scope){}])</script> 
	</head>
	<body>
		<div>   
		...Do something
		</div> 
	</body>
</html>
&#13;
&#13;
&#13;