3 Useful Input Decorator Features in
Вставка
- Опубліковано 18 лип 2023
- #frontendSnack 24💡These 3 useful component input features make your code much cleaner in #angular16 🤓
Level up your Angular skills with my advanced courses 🚀
bit.ly/advanced-angular-courses
💡 Follow me also in:
Twitter - / decodedfrontend
Instagram - / decodedfrontend
LinkedIn - / dmezhenskyi
keep doing this short please 🙏
The alias would work nice with the transform. Perhaps you transform some input object to a formgroup. Then it would make sense to have it named differently after the transform
Просто лучший!
you miss input routes, you can access route params directly in your component usign input decorator
Godsent
What would be the use case for 3rd tip?
Amazingly helpful tips! Just started learning Angular, required inputs wasn't a thing before Angular 16? How did Angular implement the React's equivalent of required props before?
Watching this I love Angular even more ❤️ These features are like motherʼs care!
yes learned new thing❤️
Excellent
Thanks 🙏
If I remember correctly, the get must apper first , before set in order to work. And alias was available always as Input('alias')
Thanks for your comment. Maybe in some other languages the order of getters/setters matters but as far as I know in JS it is not the case. Yes, the input aliases were available always but 1 min is not enough to mention all these nuances, so I am happy that you mentioned it in the comments ;)
I always learn something new from your videos!
AFAIK the input transform wasn’t mentioned in angular’s “new features” post. Honestly that’s a pretty big one.
@@eqprog maybe because it was released as part of the minor 16.1 release later
@@DecodedFrontend Yes, You are totally rigths, I checked it out, there is no difference where place the Input() decorator -on get jr on set and also it does not depend of order in code. Thank you, as always useful video.
I prefer ngOnChanges instead of getter/setter (angular 15 and below). Getters can cause performance issues. Or we can use pipe :)
what about router inputs ??
That’s available too but from my point of view it is more the router feature rather than inputs itself :)