uncaught SyntaxError: Unexpected token < angular.min.js:1

uncaught SyntaxError: Unexpected token < angular.min.js:1

这背后的可能原因是什么?我无法解决这个问题。 API 运行良好,只是因为这个错误,我无法将它与前端集成。

这里是 index.js 文件:

<html lang="en" ng-app="todoApp">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>::CRUD::</title>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
  <script src="core.js"></script> 
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    </head>
<body ng-controller="mainController">
  <div class="container">
    <div class="jumbotron text-center">
      <h1>Todo CRUD App<span class="label label-info">{{ todos.length }}</span></h1>
    </div>
    <div id="todo-list" class="row">
      <div class="col-sm-4">
        <div class="checkbox" ng-repeat="todo in todos">
          <label>
            <input type="checkbox" ng-click="deleteTodo(todo._id)">{{todo.text}}
          </label>
        </div>
    </div>
  </div>

  <div id="todo-form" class="row">
    <div class="col-sm-8 text-center">
      <form>
        <div class="form-group">
          <input type="text" class="form-control input-lg text-center" placeholder="Add a todo here" ng-model="formData.text">
        </div>
        <button type="submit" class="btn btn-primary btn-lg" ng-click="createTodo()">Add</button>
      </form>
    </div>  
  </div>
  </div>
</body>
</html>

我认为您没有在文件中指定您的应用程序。 像这样..

  <div ng-app="exampleApp">

您只指定了您的控制器。

谢谢大家,错误已解决。我只需要在脚本标签中添加 type="javascript"