Тёмный

Resolve Route Guard in Angular | Angular Routing | Angular 13+ 

procademy
Подписаться 51 тыс.
Просмотров 13 тыс.
50% 1

The Angular Resolve route guard or Angular Resolvers allow us to load some data before we navigate to a Route. In this lecture you will learn what is Angular Resolve guard and how to use it in a Angular Application.
The Angular renders the Angular Component, when we navigate to a route. The component will then send an HTTP request to back-end server to fetch data so as to display it to the user. We generally do this in ngOnInit Life cycle hook
The Problem with this approach is that, the user will see a empty component for the time the data is not available. The component will show the data after it arrives. The one way to solve this problem is to show some loading indicator to the user for the time the data is being loaded from server
The another way to solve this is to make use the Resolve route guard. The Resolve route guard pre fetches the data before navigating to the route. Hence the component is rendered along with the data. Lets understand resolve route guard with an example.
DOWNLOAD SECTION SOURCE CODE HERE: drive.google.com/file/d/16SYO...

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

 

22 мар 2022

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 17   
@AnnaBriker
@AnnaBriker Год назад
First of all, sir, I love your lectures, this is the best Angular tutorial I found on RU-vid. I watch your videos several times and learn to program by repeating after you. Huge thanks to you for your work. I have a small correction for this video though. On the 5:54 timeframe, you say that inside the getAllCourses() method the returning type will be an array of courses (if we will create an interface of courses), but in fact it will be a Promise with the type of courses array. Maybe you mean that too, but when I was trying to implement this I got an error in my IDE. That's why I decided to share it, maybe it will help to someone else who is watching this videos. And again, thank you so much for your labor!
@Abdulazizweb
@Abdulazizweb 8 месяцев назад
Crystal clear explanations brother
@sergiocebrian85
@sergiocebrian85 Год назад
Great job! I've never seen this technique in the projects before, but it's important in some cases. Thank you for your explanation.
@leninnani5222
@leninnani5222 2 года назад
Finally I got clarity about resolve route guard, thanks man😍
@shivpratapshukl5177
@shivpratapshukl5177 2 года назад
Best angular tutorial series, i am watching right now. 🔥
@mohammedabdulaziz3658
@mohammedabdulaziz3658 2 года назад
Again great lecture by given you sir, awesome example a lot of information about resolve guard now it's total crystal clear with a dynamic example.
@joseusechec.7710
@joseusechec.7710 Год назад
Thank you so much for your explanation. it was very clear for me. Best Regards from Venezuela.
@lewispil3529
@lewispil3529 Год назад
great video
@_rachid
@_rachid 11 месяцев назад
Thank you
@Danieloss98
@Danieloss98 Год назад
great!
@danlu1578
@danlu1578 Год назад
Can you explain why we are return courseList (which is a Promise) in the getAllCourses. Isn't getAllCourses returning an array of a "Course class model" (we didn't implement the class model for the course).
@ismaeelmoosa1025
@ismaeelmoosa1025 Год назад
I have question why we don't use observables methods for similar data that will display what ever data was ready from the whole data?
@SrinathJog
@SrinathJog Год назад
can you please give some more examples or real time scenarios where we can use resolve
@waelltifi
@waelltifi Год назад
it is completely useless in real life ...
@atulram8206
@atulram8206 2 года назад
I dont see the point of using a resolver in any application. The user wouldn't know what is going on behind the scenes when the button is clicked and might want to click the button again and again. Can you please give a use case where using a resolver is better
@procademy
@procademy 2 года назад
That's right. That's why we need to display a data loading image while tha Data is loading in the background. I will cover how to do that in my next lecture. Stay tuned 🙂
@arshadreacts3540
@arshadreacts3540 Год назад
yes it make he confusion in the mind of user either the link is working properly or not.. it is better to use loader to keep user calm that your data is loading wait....