0
看到代碼在這裏:http://plnkr.co/edit/xIRiq10PSYRsvNE0YWx7?p=preview。從原來的角度路由器更新角部件路由器給出的錯誤:
我收到以下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"] }]
});
}());
感謝您的回覆。關於第二個錯誤,從我的理解ng-outlet就像ng-view。所以,我將它添加到** movie-app-component.html **之前。我不明白。你可以說得更詳細點嗎。謝謝。 – nikhil