March 2017
Intermediate to advanced
821 pages
18h 21m
English
In SPA, the routes for our app are defined in the frontend. In Angular 2, we need to define the paths and a component associated with the path that will be rendered for that path.
We provide the routes to the root component, and the root component displays the component bound to the route.
Let's create the root component and routes for our search engine template:
index.js file to to create the root components and routes:var AppComponent = ng.core.Component({ selector: "app", directives: [ng.router.ROUTER_DIRECTIVES], templateUrl: "componentTemplates/app.html" }).Class({ constructor: function(){} }) AppComponent = ng.router.RouteConfig([ { path: "/", component: HomeComponent, name: ...Read now
Unlock full access