Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery导入(AngularJS)中的语法错误_Jquery_Angularjs - Fatal编程技术网

jQuery导入(AngularJS)中的语法错误

jQuery导入(AngularJS)中的语法错误,jquery,angularjs,Jquery,Angularjs,我得到一个错误,说我正在使用的jQuery的导入版本包含语法错误。它是唯一一个导入了这个问题的库——包括AngularJS和Bootstrap(它们工作正常)。我确实需要jQuery,因为bootstrap实例依赖于它——我打算使用它 Plunker显示问题。打开控制台并刷新plunker以查看问题。 这很奇怪,我以前从未见过。错误概述如下 SyntaxError: Syntax error at window.execScript (https://code.jquery.com/jq

我得到一个错误,说我正在使用的jQuery的导入版本包含语法错误。它是唯一一个导入了这个问题的库——包括AngularJS和Bootstrap(它们工作正常)。我确实需要jQuery,因为bootstrap实例依赖于它——我打算使用它

Plunker
显示问题。打开控制台并刷新
plunker
以查看问题。

这很奇怪,我以前从未见过。错误概述如下

SyntaxError: Syntax error
   at window.execScript (https://code.jquery.com/jquery-1.11.2.js:339:5)
   at globalEval (https://code.jquery.com/jquery-1.11.2.js:338:6)
   at converters.text script (https://code.jquery.com/jquery-1.11.2.js:9766:4)
   at ajaxConvert (https://code.jquery.com/jquery-1.11.2.js:8838:7)
   at done (https://code.jquery.com/jquery-1.11.2.js:9259:4)
   at callback (https://code.jquery.com/jquery-1.11.2.js:9713:8)
   at send (https://code.jquery.com/jquery-1.11.2.js:9719:7)
   at ajax (https://code.jquery.com/jquery-1.11.2.js:9210:5)
   at jQuery._evalUrl (https://code.jquery.com/jquery-1.11.2.js:9368:2)
   at domManip (https://code.jquery.com/jquery-1.11.2.js:5977:10) <div class="ng-scope" ng-view="">

我还应该补充一点,我曾尝试使用多个版本的jQuery,并且它是唯一一个向我提供问题的库。

我的main.html文件中有一个格式错误的CSS引用(隐藏在我之外…),这导致了语法错误

你得到了一个冰冷的SyntaxError。IDE可能会在代码中为您突出显示它。不要在jQuery中查找错误,它可能存在于自定义代码中。app.js、main.ctrl.js或map.dir.js。此外,调试时不要使用任何缩小的文件,在使用angular.js和angular-route.js时,错误会更清楚。也。。。JS是一种异步语言。由于您使用的是jquery的非精简版本和Angular的精简版本。。。在调用依赖jQuery的函数时,jQuery很可能尚未加载。(试着查看require.js)你能在
plunker
jfiddle
中重现同样的内容吗?@stevenca请查看
plunker
。我在代码中看不到语法错误。如果我删除jQuery和引导,我就没有错误(jQuery需要引导)。从功能上讲,代码运行良好,但我需要引导来正确格式化它。尝试单击地图以了解我的意思。
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>AngularJS Tutorial</title> <script src="https://code.jquery.com/jquery-1.11.2.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://openlayers.org/en/v3.11.2/css/ol.css" type="text/css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.min.js"></script> <script src="app.js"></script> <script src="main.ctrl.js"></script> <script src="map.dir.js"></script> <link rel="stylesheet" href="http://openlayers.org/en/v3.11.2/css/ol.css" type="text/css"> <script src="http://openlayers.org/en/v3.11.2/build/ol.js" type="text/javascript"></script> <style> .map { height: 500px; width: 500px; } </style> </head> <body ng-app="app" ng-controller="MainController"> <h1>Map Viewer</h1> <div ng-view></div> </body> </html>