(Angular 6) Which one is best way to show the activated route name in title component?

42 views
Skip to first unread message

jaint Rai

unread,
Aug 23, 2019, 6:33:58 AM8/23/19
to ang...@googlegroups.com
Hey there,

I am getting confused to get the activated route value in the active component title on a page.
One of my friend updated the way using NavigationEnd / Router & Event as shown below in screenshot (In green color).

image.png
Coud you please tell me is there any other best way to show the Name in title of Active Component in angular 6?

thanks!

Sander Elias

unread,
Aug 25, 2019, 1:41:10 AM8/25/19
to Angular and AngularJS discussion
Hi Jaint,

You can set the title from the components you route to. 
using the setTitle service makes that a lot easier.

If you insist on doing it from the router, you can use a route guard to handle this.

Regards
Sander

jaint Rai

unread,
Aug 25, 2019, 10:58:43 AM8/25/19
to ang...@googlegroups.com
Can you please send me a example of routerGaurd. It would be better for me.

Thanks & Regards
Jainendra Rai

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/9fbabbb6-e90f-4abf-a83d-1455e59d9418%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages