這是我route.js:AngularJS路由失敗
var app = angular.module('tradePlace', ['ngRoute', 'tradeCntrls']);
app.config(['$routeProvider', '$locationProvider', function($route, $location) {
$route.
when('/', {
redirectTo: '/index'
}).
when('/index', {
templateUrl: './includes/templates/index.html',
controller: 'indexCntrl'
}).
when('/register', {
templateUrl: './includes/templates/register.html',
controller: 'registerCntrl'
}).
when('/home', {
templateUrl: './includes/templates/home.html'
}).
when('/registerCompleted/:email', {
templateUrl: './includes/templates/registerCompleted.html',
controller: 'activationInstrCntrl'
}).
otherwise({
redirectTo: '/index'
});
$location.html5Mode(true);
}])
這是activationInstCntrl:
var app = angular.module('tradeCntrls');
app.controller('activationInstrCntrl', ['$scope', '$routeParams', function($scope, $route){
$scope.email = $route.email;
}])
而且模板:
hi {{email}}
當我去mysite.com/
路由器做他的工作,但當我去mysite.com/registerCompleted/hi
我得到一個空白頁和一些奇怪的錯誤在利弊ole:
Uncaught SyntaxError: Unexpected token < routes.js:1 Uncaught SyntaxError: Unexpected token < loginService.js:1 Uncaught SyntaxError: Unexpected token < registerService.js:1 Uncaught SyntaxError: Unexpected token < indexCntrl.js:1 Uncaught SyntaxError: Unexpected token < registerCntrl.js:1 Uncaught SyntaxError: Unexpected token < activationInstrCntrl.js:1 Uncaught object
我有搜索,但我找不到爲什麼我得到的錯誤和解決方案是什麼?
你能在「使用連接的URL提供了一個例子一個主播「,請問? –