angular.js:12477语法错误:意外的标记>

时间:2015-10-16 22:23:17

标签: angularjs

搜索但尚未找到解决方案。

环境:

角度1.4.7 铬43.0.2357.124 ubuntu pc

问题:

myBoardStatus.html使用socket.io与node.js服务器通信。 当node.js服务器看到'/ myBoardStatus'时,它sendfile(path.resolve('../client/myBoardStatus.html')

myBoardStatus.html有这一行

<script src='/socket.io/socket.io.js'></script>

现在这2个URL工作正常,在chrome浏览器中我可以偶尔看到来自服务器的消息。

http://10.55.200.47:80/myBoardStatus

http://10.55.200.47:80/myBoardStatus.html

可是:

在我的index.html中,我有<div ng-view></div>。 通过$ routeProdiver对其他页面工作正常,当我点击按钮时,这个div的内容会更新。

所以我添加了另一个按钮“myBoardStatus”,试图将socket.io中的消息显示给这个div。

http://10.55.200.47:80/#/5myBoardStatus

$routeProvider.when('/5myBoardStatus', {
    templateUrl: 'myBoardStatus.html'
    //redirectTo: '/myBoardStatus.html'
});

得到了这个:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
angular.js:12477 SyntaxError: Unexpected token >
    at eval (native)
    at http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:2:2620
    at Function.m.extend.globalEval (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:2:2631)
    at m.fn.extend.domManip (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:3:23046)
    at m.fn.extend.append (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:3:20507)
    at null.<anonymous> (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:3:22055)
    at m.access (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:3:3286)
    at m.fn.extend.html (http://10.55.200.47:80/3rdparty/jquery/jquery.min.js:3:21623)
    at link (http://10.55.200.47:80/3rdparty/angular-1.4.7/angular-route.min.js:7:200)
    at aa (http://10.55.200.47:80/3rdparty/angular-1.4.7/angular.min.js:73:90) <div ng-view="" class="ng-scope">(anonymous function) @ angular.js:12477$get @ angular.js:9246aa @ angular.js:8791K @ angular.js:8289g @ angular.js:7680(anonymous function) @ angular.js:7555$get.g @ angular.js:7699r @ angular.js:8316x @ angular-route.js:935$get.n.$broadcast @ angular.js:16311(anonymous function) @ angular-route.js:619(anonymous function) @ angular.js:14745$get.n.$eval @ angular.js:15989$get.n.$digest @ angular.js:15800$get.n.$apply @ angular.js:16097h @ angular.js:10546K @ angular.js:10744z.onload @ angular.js:10685

(The 1st line "Synchronous XMLHttpRequest on the main thread is deprecated" is warning)

如果我使用redirectTo而不是templateUrl,则浏览器中没有任何内容。

感谢您的帮助!

0 个答案:

没有答案