Reputation: 19
I am having three components that load simultaneously when angular app load. Is there any way that we can load component only when specific route navigate to.
Upvotes: 1
Views: 3482
Reputation: 2640
This is what the Angular 2 Router is all about. I strongly suggest you read the documentation on Router thoroughly.
https://angular.io/docs/ts/latest/guide/router.html
The steps you need to do are roughly the following:
my-app
) for your app with a <router-outlet>
placeholder within its template.<my-app></my-app>
) in your index.html
file<router-outlet>
element.Upvotes: 1