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 : Best practices after the renaissance #2

#angular #standalone

Using standalone components gives you more control over your components compared to the traditional NgModules approach. It allows you to import components directly into each other without the need to go through modules. Standalone components help reduce the number of modules in your project, which translates to less code to manage.
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
🌐 Angular : Best practices after the renaissance #3

#angular #inject

In this section, I want to emphasize the importance of using the utility function inject() for service or component injection, rather than relying on the traditional constructor-based approach. The inject() function is more flexible and allows for cleaner, more readable code. It simplifies testing, supports better dependency management, and aligns with Angular's ongoing improvements to enhance the developer experience. By adopting inject(), you can take advantage of a more modern and efficient way to handle dependency injection in Angular applications.
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
πŸ’› NgTemplateOutlet Type Checking

#angular #directive #ngTemplateOutlet

βœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘2
🚱 No more try-catch

#js #trycatch

An amazing new JavaScript operator has arrived and things are not looking too good for try-catch!

While we wait for ?= to become natively integrated into JavaScript, we can start it now with this polyfill


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
🩢 Media query matcher in Angular with RxJS, signals and NgClass

#angular #signals #service #matchMedia

To achieve the desired outcome, I’ve opted for an approach that follows this pattern:

β€” Create a service with a `mediaQuery()` method, which returns an RxJS Observable containing information on whether a specific breakpoint is matched or not.

β€” Create a property inside the component class (in the example we will call it `isMobile`, since we have only one breakpoint) and bind it the the `mediaQuery()` method previously crafted, but also converting the Observable to a signal.

β€” Utilize the `NgClass` directive to dynamically apply a class based on the value of the `isMobile` property.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
πŸ“„ Button Design β€” UI component

#info #button #design #guide

βœ… Article Link
πŸ‘1