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
✳️ Detecting unsaved changes in Angular Forms with confirmation window via Guard

#angular #rxjs #forms #guard #shareReplay

βœ… Link: https://netbasal.com/detect-unsaved-changes-in-angular-forms-75fd8f5f1fa6
πŸ“„KeycloakAuthGuard in Angular

#angular #guard #keycloak #mapToCanActivate

🚩 > Angular v16

Add the guard function to your route’s canActivate property.

// In your routing module
{
path: 'protected-route',
canActivate: [keycloakFunctionalGuard],
component: ProtectedComponent
}


⚠️ Using mapToCanActivate Helper
If you’re not ready to fully migrate to functional guards, Angular 16 provides a helper function, mapToCanActivate, that allows you to continue using your class-based guards.

{
path: 'protected-route',
canActivate: mapToCanActivate([wrappedAuthGuard]),
component: ProtectedComponent
}


βœ… Article link: https://medium.com/@kapincev/migrating-keycloakauthguard-to-angular-16-functional-guards-01bf2a20fc09
πŸ“„ Deactivate Route Guards in Angular

#angular #guard #ui_element

The CanDeactivate route guard in Angular is responsible for determining if a route can be deactivated. It is commonly used when you want to check if the user is allowed to leave a particular component or route, perhaps due to unsaved changes or other dynamic conditions.


βœ… Article link
πŸ”₯2
πŸ“„ Simple Unsaved Data Changes Guard in Angular 17+

#angular #guard #ui_element

...when a user wants to navigate to other routes having pending data changes in the current page...


βœ… Article link
πŸ‘5
πŸ“„ Permission/Role-based Security

#angular #guard #guide

No matter what client application you are working with, the following are the five ingredients that are needed to implement permission-based security:

1 β€” Client-side API Resource
2 β€” Client Side Session Service
3 β€” Fall-back Route
4 β€” Navigation Guards
5 β€” Fragment Guards

βœ… Article link
🌐 πŸ–€ `CanMatch` Interface in Angular Router (2024)

#angular #guard #router #routing

The CanMatch interface is a part of Angular’s routing mechanism that enables conditional route matching. It provides a way to define guard logic that runs before the router tries to activate a route. If all CanMatch guards return true, the router proceeds with navigation to the route. If any guard returns false, the route is skipped for matching, and the router evaluates other route configurations.


βœ… Article link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2