javascriptangularjsangular-componentsangularjs-1.5angular-component-router

Update to angular component router from original angular router gives the errors:


See the code here: http://plnkr.co/edit/xIRiq10PSYRsvNE0YWx7?p=preview.

I'm getting the following 2 errors.

  1. Route must provide either a path or regex property
  2. [$compile:ctreq] http://errors.angularjs.org/1.5.3/$compile/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"
});
}());

movie-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"] }]
});
}());

Solution

  • You made a typo: paht should be path.

    The second error is because your controller 'ngOutlet', required by directive 'ngOutlet', can't be found.