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
πŸ’› 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
🩢 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
πŸ’™ Angular: Design Patterns

#angular #patterns

Why Design Patterns are important

1. Scalability

Design Patterns help break your app into small, reusable pieces. This makes it easy to add new features later without messing up existing ones.

2. Maintainability

Following design patterns ensures your code has a clear, organized structure.

For example using patterns like the Singleton Pattern makes the app more maintainable because you only have to change one piece of code in the service, and all the components that depend on it will automatically adapt.

3. Testability

Design patterns promotes the separation of concerns which makes it easier to mock and test components

4. Code Reusability

Patterns encourage writing reusable code.

For example, patterns like Factory and Singleton help you organize similar tasks in one place, so you can easily reuse them without rewriting the same logic.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4
❀️ 1/2 Maximizing Productivity in Angular: Advanced Configurations in angular.json

#angular #schematics #angularjson

Angular, a popular web application framework, provides a powerful configuration file called angular.json that allows developers to fine-tune various aspects of their projects. In this article, we will explore some advanced configurations in the angular.json file to enhance your development workflow.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
❀️ 2/2 Maximizing Productivity in Angular: Advanced Configurations in angular.json

#angular #schematics #angularjson

Angular, a popular web application framework, provides a powerful configuration file called angular.json that allows developers to fine-tune various aspects of their projects. In this article, we will explore some advanced configurations in the angular.json file to enhance your development workflow.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6❀1
❀️ Building a Strong Angular Folder Structure

#angular #guide #folders

A well-organized folder structure is essential for developing scalable, maintainable, and efficient Angular applications. It helps teams navigate the codebase easily, promotes reusability, and streamlines the development process.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
πŸ€“ From RxJS to Signals

#angular #rxjs #signals

βœ… Article Link
πŸ‘7
πŸ’™ Dynamically Change Angular Material Theme Colors

#angular #theme

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3
πŸ–€πŸ€ Keycloak for Angular 19+

#angular #keycloak

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
πŸ’™ Angular Performance with Deferrable Views

#angular #defer

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯2πŸ‘1
❀️ Building Micro Frontends in Angular with @angular-architects/native-federation

#angular #moduleFederation

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5
🩢 Configure a Proxy in Angular for API Calls

#angular #proxy

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3❀1
🩢 Configure Angular’s Advanced proxyConfig

#angular #proxy

Angular’s proxyConfig provides a convenient and efficient workaround for the CORS issue during development. It essentially acts as a reverse proxy, intercepting requests from your Angular application and forwarding them to the backend server.

The key benefit is that the browser sees all requests originating from the same origin (your Angular application’s development server), thus bypassing the CORS restrictions.

In essence, the workflow is as follows:

Your Angular application running on localhost:4200 makes a request to /api/data.
β€” The proxyConfig intercepts the request.
β€” The proxyConfig forwards the request to http://localhost:8080/api/data.
β€” The backend server processes the request and sends a response back to the proxyConfig.
β€” The proxyConfig relays the response back to your Angular application.

Since the request appears to originate from the same origin, the browser happily allows the communication, and you can seamlessly develop your Angular application without the CORS headache.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4
πŸ’™ Strategies to Reduce Memory Usage

#angular #cdr #workers

Common Causes of High Memory Usage in Angular

1. Memory Leaks: Components and services not properly cleaned up can cause memory leaks.
2. Excessive DOM Manipulation: Too many DOM elements or frequent updates can increase memory consumption.
3. Large Data Objects in Memory: Keeping large objects or arrays in memory unnecessarily bloats memory usage.
4. Unoptimized Change Detection: Running change detection frequently for all components degrades performance.
5. Improper Use of Observables: Subscriptions that are not unsubscribed can lead to memory leaks.
6. Large Bundle Size: Loading too much JavaScript can impact memory consumption.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
πŸ€“πŸ©Ά Implementing Dependency Inversion in Angular Using Injection Tokens

#angular #services #InjectionToken

βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
🩷 Stop Using BehaviorSubject in Every Angular Service

#angular #signals

BehaviorSubject Is a Loaded Gun

It holds state, pushes values, and is hot by default. That means:

β€” Every new subscriber instantly gets the last value
β€” You must manually manage .next() calls
β€” It often leads to imperative logic (e.g. if (...) this._value$.next(...))
β€” And worst of all?

It gives you a stream, but not semantics.

You can’t know if the value is:

β€” Cached
β€” Live from server
β€” Derived from another value
β€” Meant to be read-only


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
2πŸ‘7❀1