将控制器添加到ngRoute时出现意外的标识符

Ole*_*g V 8 html javascript angularjs

我遇到了这样的问题,当我将控制器添加到我的路由代码时,它没有意外的标识符.不知道为什么会发生这是我的路线提供者:

    app.config(function($routeProvider) {
        $routeProvider
          .when("/login", {
            title: 'Login',
            templateUrl: 'assets/login.html'
            controller: authCtrl
        })
    });
Run Code Online (Sandbox Code Playgroud)

这是我的控制器:

    app.controller('authCtrl', function ($scope, $rootScope, $routeParams, $location, $http, Data) {
    //initially set those objects to null to avoid undefined error
        $scope.login = {};
        $scope.signup = {};
        $scope.doLogin = function (customer) {
        Data.post('login', {
           customer: customer
         }).then(function (results) {
            Data.toast(results);
         if (results.status == "success") {
             $location.path('dashboard');
         }
         });
       };
        $scope.signup = {email:'',password:'',name:'',phone:'',address:''};
        $scope.signUp = function (customer) {
         Data.post('signUp', {
            customer: customer
         }).then(function (results) {
         Data.toast(results);
         if (results.status == "success") {
            $location.path('dashboard');
          }
       });
      };
      $scope.logout = function () {
        Data.get('logout').then(function (results) {
        Data.toast(results);
        $location.path('login');
      });
       }
    });
Run Code Online (Sandbox Code Playgroud)

我在我的html中包含了这样的路径:

   <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"/>
   <script src="app/angular-route.min.js"></script>
   <script src="app/angular-animate.min.js" ></script>
   <script src="app/toaster.js"></script>
   <script src="app/app.js"></script>
Run Code Online (Sandbox Code Playgroud)

Emi*_*nge 2

您的代码中有一些拼写错误:

 app.config(function($routeProvider) {
        $routeProvider
          .when("/login", {
            title: 'Login',
            templateUrl: 'assets/login.html', // <---- missing ','
            controller: 'authCtrl' // <----- should be format to string
        })
    });
Run Code Online (Sandbox Code Playgroud)

不确定是否能解决您的问题