Тёмный

CanActivateChild Route Guard - Angular (Tutorial #25) 

Nisha Singla
Подписаться 32 тыс.
Просмотров 17 тыс.
50% 1

CanActivateChild Route Guard in Angular - Tutorial no. 25
The Angular invokes CanActivateChild guard whenever the user tries to navigate to any of its child route.
This allows us check some condition and decide whether to proceed with the navigation or cancel it.
Use this link to share this video : • CanActivateChild Route...
You can also visit my following videos:
CanActivateRouteGuard: • CanActivate Route Guar...
Nested Routing: • Nested Routes - Angula...
Router Parameters: • Route Parameters - Ang...
Routing: • Routing - Angular (Tut...
Guards in angular are interfaces which can tell the router whether or not it should allow navigation to a requested route.
So If all guards return true, navigation will continue. If any guard returns false, navigation will be cancelled.
Guards return either true if the user can access a route or false if they can’t.
They can also return an Observable or Promise that later on resolves to a boolean in case the guard can’t answer the question straight away,
for example it might need to call an API. Angular will keep the user waiting until the guard returns true or false.
There are five different types of Guards:
CanActivate
Checks to see if a user can visit a route.
CanActivateChild
Checks to see if a user can visit a routes children.
CanDeactivate
Checks to see if a user can exit a route.
Resolve
Performs route data retrieval before route activation.
CanLoad
Checks to see if a user can route to a module that lazy loaded.
For a given route we can implement zero or any number of Guards.
If we talk about the difference between canActivate and canActivateChild RouteGuard, then we can say
When we apply canActivateGuard it always check parent route accessibility. If Parent route is accessible, automatically its child routes are also accessible. But in some situation we may have some other criteria to check
before executing child route event when parent route is accessible.
CanActivateChild Guard is simply a service that implements the CanActivateChild interface and overrides the canActivateChild() method.
In this case, it always returns true which means access to child Routes will be always granted to the user when this guard is applied to a route.
Angular Tutorial Series:
• Introduction- Angular ...
Follow me on:
►RU-vid : / nishasingla
►Facebook : / angularjs4beginners
►LinkedIn : / nishasingla

Опубликовано:

 

10 май 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@joydippaul4605
@joydippaul4605 Год назад
Your teaching way is top-notch.
@zubinthoughts
@zubinthoughts 2 года назад
i love way you explain everything in details thanks
@NishaSingla
@NishaSingla 2 года назад
You’re welcome
@coolmuna7820
@coolmuna7820 4 года назад
Well explained.
@dke4772
@dke4772 3 года назад
very simple and good explanation
@NishaSingla
@NishaSingla 3 года назад
Thanks 🙏
@sreedhar333
@sreedhar333 2 года назад
Hi Nisha ji , your videos are very good. Most of the doubts regarding Observables, Promises, Subject & BehaviouralSubject are clarified. I'm thankful to you . Jus one thing I would like to add, Most of the videos are having missing Previous button. It would be good to add it.Once again thanks for the videos
@MANOJKUMAR-by1yy
@MANOJKUMAR-by1yy 3 года назад
Great work
@NishaSingla
@NishaSingla 3 года назад
Thank you 😊
@IqbalAhmed-qk5ix
@IqbalAhmed-qk5ix 3 года назад
Superb mam Nice Explain Thank u so much
@NishaSingla
@NishaSingla 3 года назад
Keep watching
@tuhairweronnie7385
@tuhairweronnie7385 Год назад
Nisha,,, i will buy you lunch when u come to Usa , you have no idea how u help with those vedios
@dhavalsolanki3691
@dhavalsolanki3691 2 года назад
Hello Mam, one question. If in our service, it is mentioned provideIn root, do we have to enter a value in app.module's providers' array?
@deepakverma-uo7pf
@deepakverma-uo7pf 2 года назад
mem dynamic role implement in angular role guard , how to
@vedhalokanadham9254
@vedhalokanadham9254 3 года назад
can you make more videos please
@polyanimation1698
@polyanimation1698 3 года назад
nice :)
@NishaSingla
@NishaSingla 3 года назад
Thanks for the visit
@pardhasaradhinaidu602
@pardhasaradhinaidu602 4 года назад
Make video on JWT tokens authentication for experience guy's
@NishaSingla
@NishaSingla 4 года назад
It may take some time for that, but will try to create it. thanks
@akash.deep1001
@akash.deep1001 2 года назад
@@NishaSingla Please make the video on Jwt tokens and other tokens