Introduction to Routing & Navigation in angular 4 example
Add the
ng generate module app-routing --flat --module=app
There are new requirements for the Tour of Heroes app:
- Add a Dashboard view.
- Add the ability to navigate between the Heroes and Dashboardviews.
- When users click a hero name in either view, navigate to a detail view of the selected hero.
- When users click a deep link in an email, open the detail view for a particular hero.
When you’re done, users will be able to navigate the app like this:
Add the AppRoutingModule
An Angular best practice is to load and configure the router in a separate, top-level module that is dedicated to routing and imported by the root
AppModule
.
By convention, the module class name is
AppRoutingModule
and it belongs in the app-routing.module.ts
in the src/app
folder.
Use the CLI to generate it.
0 comments:
Post a Comment