0

看到代碼在這裏:http://plnkr.co/edit/xIRiq10PSYRsvNE0YWx7?p=preview從原來的角度路由器更新角部件路由器給出的錯誤:

我收到以下2個錯誤。

  1. 路線必須提供一個路徑或正則表達式特性
  2. [$編譯:ctreq] http://errors.angularjs.org/1.5.3/ $編譯/ ctreq P0 = ngOutlet & P1 = ngOutlet

索引.html

<!DOCTYPE html> 
<html ng-app="favMoviesList"> 
<head> 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js</script> 
<script src="https://unpkg.com/@angular/[email protected]/angular1/angular_1_router.js"></script> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" /> 
<script src="module.js"></script> 
<script src="movies-list-component.js"></script> 
<script src="movie-rating-component.js"></script> 
<script src="movie-app-component.js"></script> 
</head> 

<body> 
<movie-app></movie-app> 
</body> 

</html> 

module.js

(function(){ 
var module = angular.module("favMoviesList",["ngComponentRouter"]); 

module.value("$routerRootComponent","movieApp"); 

module.component("appAbout",{ 
template:"This is about page" 
}); 
}()); 

電影APP-component.js

(function(){ 
var module = angular.module("favMoviesList"); 

module.component("movieApp",{ 
templateUrl:"movie-app-component.html", 
$routeConfig:[ 
    { path:"/list",component:"movieList",name:"List"}, 
    { path:"/about",component:"appAbout",name:"About"}, 
    { paht:"/**", redirectTo:["List"] }] 
}); 
}()); 

回答

0

你犯了一個錯字:paht應該path

第二個錯誤是因爲找不到指令'ngOutlet'所需的控制器'ngOutlet'。

+0

感謝您的回覆。關於第二個錯誤,從我的理解ng-outlet就像ng-view。所以,我將它添加到** movie-app-component.html **之前。我不明白。你可以說得更詳細點嗎。謝謝。 – nikhil