Angular πŸ‡ΊπŸ‡¦ - practical notes
1.63K subscribers
1.6K photos
1 file
532 links
Angular - practical notes

This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Download Telegram
πŸ“„ Angular HostAttributeToken: the new way to inject attributes

#angular #attribute #HostAttributeToken

By creating an input, you are instructing Angular to create a binding to that property and check it during each change detection cycle. That is really excessive, you only need that property to be checked once during component initialization. 🀯 To make this more performant you can instead inject the host-element attribute in the constructor thanks to the Attribute decorator


Since the release of Angular 14 there is now a cleaner approach to inject providers without using the constructor class: the inject() function. Up until now, this inject() function allowed to inject easily components, directives and pipes, but it was missing a method to inject host attributes. And that’s precisely why the HostAttributeToken class was introduced


βœ… Article link
πŸ€“ Replacing Static Inputs with the Host Attribute Token

#angular #decorator #Attribute #HostAttributeToken

🚩 > Angular 17

βœ… Article link
πŸ‘1