请参阅此处的代码:http://plnkr.co/edit/xIRiq10PSYRsvNE0YWx7?p=preview。
我收到以下2个错误。
- 路由必须提供路径或正则表达式属性
- [$编译:ctreq] http://errors.angularjs.org/1.5.3/ $编译/ ctreq P0 = ngOutlet&安培; P1 = ngOutlet
醇>
的index.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/router@0.2.0/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"
});
}());
电影应用内-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 :(得分:0)
您输错了:paht
应为path
。
第二个错误是因为无法找到指令&#39; ngOutlet
&#39;所需的控制器&#39; ngOutlet
&#39; < / p>