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
❀️ 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
πŸ“΅ Promise.try()

#js #promises

What is Promise.try()?
In essence, Promise.try() is a static method that wraps any function β€” be it synchronous, asynchronous, value-returning, or exception-throwing β€” into a Promise. It effortlessly handles both sync and async functions while automatically catching synchronous exceptions, preventing error leaks. 🎭

Advantages of Promise.try()
1 β€” Unified Handling: Seamlessly manages both synchronous and asynchronous functions, resulting in cleaner code. 🧼
2 β€” Exception Handling: Automatically captures synchronous exceptions, making error handling more intuitive and preventing oversights. πŸ•΅οΈβ€β™‚οΈ
3 β€” Code Simplicity: Compared to traditional methods, Promise.try() enhances code readability and maintainability. πŸ“š


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
πŸ“΅ Mastering Touch Interactions with Hammer.js: A Complete Guide

#js #hammerjs

What is Hammer.js? πŸ€”
Hammer.js is a lightweight JavaScript library (only 4KB) that brings multi-touch gesture support to web applications. It’s designed to work seamlessly across both mobile and desktop platforms, with excellent browser compatibility.


βœ… Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
1πŸ”₯2
πŸ’™ 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
❀️ Signals + HTTP = httpResource

#angular #httpResource

πŸ§ͺ Angular 19.2

The httpResource API is still experimental, but it will most likely replace all our usages of HttpClient in the near future, which is why I’m excited to share this now!


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