当从文件引用时,ng-view内的脚本不起作用(JQuery在角度之前加载)

时间:2021-10-03 19:38:28

I'm using angular and angular-route. The index.html looks like this:

我正在使用角度和角度路线。 index.html看起来像这样:

<!DOCTYPE html>
<html lang="en" ng-app="Showcase">
<head>
    <meta charset="UTF-8">
    <title>UCSD Showcase</title>
    <base href="/showcase/">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-route.min.js"></script>
    <script src="routes.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="js/initGlobalHelpers.js"></script>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="#########################################">
    <meta name="keywords" content="###############################################">
    <meta property="og:url" content="#">
    <meta property="og:site_name" content="CSES OSS">
    <meta property="og:image" content="############################################################################################">
    <meta property="og:description" content="#">
    <meta property="og:type" content="website">
    <meta name="twitter:site_name" content="CSS OSS">
    <meta name="twitter:site" content="################">
    <meta name="twitter:card" content="summary">
    <meta name="twitter:description" content="#">
    <meta name="twitter:image" content="#">
    <meta name="image" content="#">
    <link rel="stylesheet" media="all" href="./styles/style.css">
</head>
<body>
<ng-view></ng-view>
</body>
</html>

And then for my home page when I'm using

然后在我使用的主页上

<h1>This is the home page</h1>
<script src="home.html"></script>

I get the a warning

我收到了警告

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. jquery.min.js:4

主线程上的同步XMLHttpRequest由于其对最终用户体验的不利影响而被弃用。如需更多帮助,请查看https://xhr.spec.whatwg.org/。 jquery.min.js:4

and an error

和一个错误

SyntaxError: Unexpected token < angular.js:13550

SyntaxError:意外的标记 <13550 p="">

<><><><>


  

<><>


  

<><>