Use @Input to Read Angular Route Parameters

  Рет қаралды 10,402

Deborah Kurata

Deborah Kurata

Күн бұрын

One of the new features in Angular v16 is automatic route parameter mapping using the Input decorator.
What does that mean?
It means we can use an input property to automatically read route parameters, instead of using the Activated Route service. This gives us a shorter and easier syntax.
In this video, let's walk through an explanation and an example.
Content
00:00 Route parameter mapping using the input decorator
00:44 How routing works
03:31 Routing in action (Activated Route)
04:14 Reading route parameters (Activated Route)
05:28 Enabling route parameter mapping using the Input decorator
06:09 Reading route parameters (@Input)
07:20 Routing in action (@Input)
07:33 Why use route parameters? Deep Linking!
08:40 Wrap Up
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I love creating content for developers! I create KZbin videos and write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 10,000+) over the past 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award in Developer Technologies, and I'm a Google Developer Expert (GDE) in Angular.
Contact me on Twitter: / deborahkurata
Find my Pluralsight courses: www.pluralsight.com/profile/a...
Access my freeCodeCamp articles: www.freecodecamp.org/news/aut...
View my KZbin content: / @deborah_kurata
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#angular #bestpractices #angulartutorial #demo
#angularrouting #routinginangular #routingangular #angularroutingtutorial #whatisroutinginangular #howtoroutinginangular

Пікірлер: 67
@danielabonvini
@danielabonvini Жыл бұрын
Amazing video as always, I especially liked the little addition of the explanation about deep linking
@deborah_kurata
@deborah_kurata Жыл бұрын
Glad you liked it! Thank you!
@skayona
@skayona Жыл бұрын
Debora, thanks a lot! I wish I could explain things as you do. Thanks for doing such amazing videos!
@deborah_kurata
@deborah_kurata Жыл бұрын
That is kind of you to say. Glad you like them!
@Nabulio85
@Nabulio85 Жыл бұрын
Thank you ! Very good job, your channel deserves more subscribers
@deborah_kurata
@deborah_kurata Жыл бұрын
Thank you for watching! And yes! 😊
@ankitmvp
@ankitmvp 13 күн бұрын
Thanks a lot for this ... Really loved the way you explain the concepts ... Just wow !!! 🤩
@deborah_kurata
@deborah_kurata 12 күн бұрын
So nice of you to say. Thank you! 😊
@shubhambahre9021
@shubhambahre9021 16 күн бұрын
I simply loved this explanation
@deborah_kurata
@deborah_kurata 16 күн бұрын
Thank you!
@robertkameni5975
@robertkameni5975 Жыл бұрын
I love your stuff. Really great Job Deborah🔥
@deborah_kurata
@deborah_kurata Жыл бұрын
Great to hear! Thank you! 😊
@advance5189
@advance5189 Ай бұрын
Just wanna say that your tutorials are on point🔥.Thanks for the great content!
@deborah_kurata
@deborah_kurata Ай бұрын
Thank you so much!
@adnanrazapk1
@adnanrazapk1 Жыл бұрын
simple to the point explanation, recently subscribe and loved your content. 🔥
@deborah_kurata
@deborah_kurata Жыл бұрын
Thank you so much! 😊
@haroldpepete
@haroldpepete Жыл бұрын
great explanation, angular looks easy when you explain it
@deborah_kurata
@deborah_kurata Жыл бұрын
That is kind of you to say! Thanks! 😊
@_dinesh
@_dinesh 10 ай бұрын
amazing tips! thank you so much. 💕
@deborah_kurata
@deborah_kurata 10 ай бұрын
Glad it was helpful!
@joeyvico
@joeyvico 8 ай бұрын
Wonderful!! I always thought that the snapshot.params way was too clunky. Thanks again Deborah. Amazing teaching
@deborah_kurata
@deborah_kurata 8 ай бұрын
Glad it was helpful! 😊
@AntonioRibeiro-qs3fy
@AntonioRibeiro-qs3fy Ай бұрын
very nifty and handy....thank you
@deborah_kurata
@deborah_kurata Ай бұрын
Great to hear it was useful!
@franckozeusmakita7022
@franckozeusmakita7022 8 ай бұрын
amazing Job. thanks you from Germany!
@deborah_kurata
@deborah_kurata 8 ай бұрын
Thank you very much! 😊
@yelose85
@yelose85 6 ай бұрын
Thank you very much!😄
@deborah_kurata
@deborah_kurata 6 ай бұрын
You're welcome 😊
@lqt74
@lqt74 Жыл бұрын
Great! Thank you!
@deborah_kurata
@deborah_kurata Жыл бұрын
Thanks for watching!
@test-user-123
@test-user-123 Жыл бұрын
Cool!
@PixelFlowers
@PixelFlowers Жыл бұрын
Thank you 🎉
@ranjanadeore2957
@ranjanadeore2957 Жыл бұрын
Great thank you mam providing great content 🙂
@deborah_kurata
@deborah_kurata Жыл бұрын
Thank you for watching! 😊
@rd_45
@rd_45 Жыл бұрын
Amazing feature
@deborah_kurata
@deborah_kurata Жыл бұрын
Yes! I've been using it regularly now for my route parameters.
@TheZukkino
@TheZukkino 10 ай бұрын
Thanks for the explaination. Could you please make a video concerning form management with @Input and Signals? I've noticed that signals and forms do not fit well, mostly if the signal must be used to fullfill the form and the same data must be used to perform a submit.
@deborah_kurata
@deborah_kurata 10 ай бұрын
Glad it was useful! The signals features are not yet complete, including using them with @Input, with two-way binding, and with forms. These are features the team is still working on. I'll be sure to do some videos as soon as those features are available.
@KYO-wb9dg
@KYO-wb9dg 9 ай бұрын
Great video! Just little bit curious, is it better to use Resolver to reload data?
@deborah_kurata
@deborah_kurata 9 ай бұрын
Thank you. The down side of a resolver is that it blocks the navigation until the data is resolved. This has more info: angular.schule/blog/2019-07-resolvers
@MultiWarrr
@MultiWarrr 10 ай бұрын
can i access parent route params by this approach
7 ай бұрын
Hi Deborah, tanks for the video, does exist any difference from Input Binding for parameters and input binding for communication between components?
@deborah_kurata
@deborah_kurata 7 ай бұрын
I'm not sure I understand the context of the question. A difference in what way?
@MirceaAgrigoroaie
@MirceaAgrigoroaie Жыл бұрын
If the id is not specified in the route can we use the Input to read the url param.. for example ?id=2&name=something . Will angular know to map these to id and name inputs automatically?
@deborah_kurata
@deborah_kurata Жыл бұрын
I'm on pto this week. I'll try it when I get back to the office.
@davidkooffreh4752
@davidkooffreh4752 8 күн бұрын
Would this work in a route resolver
@scellilisa
@scellilisa 11 ай бұрын
Nice Explanations like always thanks!!! still have a small question: i have for example a search input above the product details, where i can look directly for ids of products. Imagine i looked at product 5 at first load from the component, so id:5 is in the url. but then i want to see product 10. i write 10 in my input field, on submit i load right product, but writing new id in the url did not happened. is there a new way to update that parameter? or do i need to continue injecting the router and replace more or less with navigateByUrl? hope you have an alternative way ^^ thx thank you for your help
@deborah_kurata
@deborah_kurata 11 ай бұрын
Thank you! I *think* I understand what you are asking? Any way you could create a little Stackblitz example?
@scellilisa
@scellilisa 11 ай бұрын
@@deborah_kurata seems like everytime i post the stackblitz link, my comment is removed.... where can i send it to you? thanks
@deborah_kurata
@deborah_kurata 8 ай бұрын
My apologies ... I didn't see your reply until now. What social media are you on? You can send it via one of those if you're still interested.
@peter2967
@peter2967 Жыл бұрын
7:07 Can you use input transform instead of casting to a Number? Like so: @Input({ transform: numberAttribute }) id = '';
@EmilioDegiovanni
@EmilioDegiovanni Жыл бұрын
It's a function. @Input({transform: (id) => Number(id)}) id = 0;
@deborah_kurata
@deborah_kurata Жыл бұрын
Yes! And it looks like @EmilioDegiovanni provided the syntax below. (I was planning on covering that in a separate, upcoming video. :-))
@deborah_kurata
@deborah_kurata Жыл бұрын
Thank you for providing the correct syntax!
@peter2967
@peter2967 Жыл бұрын
@@deborah_kurata Angular 16.1 actually exposes numberAttribute and booleanAttribute coercion functions to handle this
@deborah_kurata
@deborah_kurata Жыл бұрын
Yep, you are correct. I hadn't seen the new `numberAttribute` and `booleanAttribute` when I did this video. I've since put all of the above in this video: kzbin.info/www/bejne/a5C8i4l8ZbR0q5I Thank you!
@jeffnikelson5824
@jeffnikelson5824 Жыл бұрын
We love your videos deborah ❤️ but please try to come to the point faster. this video could be 3 min long and still explain the new content in detail
@deborah_kurata
@deborah_kurata Жыл бұрын
Thank you for the feedback. Yeah, I contemplated whether I should cover the "how routing works" to clarify how/where these parameters are set. Maybe that should have been its own video so the majority that already know that could skip that part?
@ErickCcsVzla
@ErickCcsVzla Жыл бұрын
@@deborah_kurata To be honest, we already have a lot of KZbin channels explaining everything really fast. I like that Deborah explains slowly and takes time to speak about small important details like in this video. But, we know how it is, it's impossible to please everybody.
@deborah_kurata
@deborah_kurata Жыл бұрын
@@ErickCcsVzla Thank you! 😊😊
@baldin13
@baldin13 6 ай бұрын
awesome video! Watched from freecode and again here on yt, if I could hit the like button 1000 times I would, tks a lot!
@deborah_kurata
@deborah_kurata 6 ай бұрын
Thank you so much!
@mihailion2468
@mihailion2468 Жыл бұрын
Oh my lord light theme
@deborah_kurata
@deborah_kurata Жыл бұрын
Out of curiosity ... is this comment because you personally use dark and this doesn't? Or is it because it is really too hard to read/see with the light theme? I ask because I know most developers use dark. But we've been told by most conferences and companies such as Pluralsight to always use light when recording videos because they are easier to see ... especially on smaller devices. Thanks!
@mihailion2468
@mihailion2468 Жыл бұрын
@@deborah_kurata Hey deborah, your video was insightful, I didn't mean to disrespect. For me, it's mainly personal, I use dark themes everywhere. But it is also an issue if I'm scrolling at 11 or 12 PM through KZbin, and the video makes my eyes bleed. Kind of hard to watch as you said. Cheers
Transform Data with Angular @Input()
10:28
Deborah Kurata
Рет қаралды 7 М.
Angular Signals: What? Why? and How?
27:08
Deborah Kurata
Рет қаралды 57 М.
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 66 МЛН
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 22 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 18 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 4,7 МЛН
Vites Fatal Flaw Fixed With Vinxi
11:23
Jack Herrington
Рет қаралды 12 М.
Zoneless Angular Applications in V18
14:00
Deborah Kurata
Рет қаралды 14 М.
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 90 М.
Input Signals in Angular 17.1 - How To Use & Test
14:34
Decoded Frontend
Рет қаралды 25 М.
Build Generalized DRY Angular Code with Generics
14:44
Deborah Kurata
Рет қаралды 8 М.
Goodbye javascript (for now)
14:57
Web Dev Cody
Рет қаралды 67 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 104 М.
The new DestroyRef Provider in Angular 16 (2023)
11:42
Decoded Frontend
Рет қаралды 12 М.
8 Товаров с Алиэкспресс, о которых ты мог и не знать!
49:47
РасПаковка ДваПаковка
Рет қаралды 167 М.
ВАЖНО! Не проверяйте на своем iPhone после установки на экран!
0:19
ГЛАЗУРЬ СТЕКЛО для iPhone и аксессуары OTU
Рет қаралды 6 МЛН
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 2 МЛН
Частая ошибка геймеров? 😐 Dareu A710X
1:00
Вэйми
Рет қаралды 2,3 МЛН
İĞNE İLE TELEFON TEMİZLEMEK!🤯
0:17
Safak Novruz
Рет қаралды 746 М.