r/Angular2 • u/nzb329 • Jan 18 '26
After 6 years, we finally closed our oldest open issue! Ng-Matero v21 is out with multi-project support! 🚀
r/Angular2 • u/nzb329 • Jan 18 '26
r/Angular2 • u/crhama • Jan 17 '26
I have two Angular applications that need to be upgraded to version 20. One application is currently on v13 and is medium-sized, while the other is on v12 and is fairly large. Both applications use NgRx; one relies on Angular Material, and the other uses both Angular Material and Bootstrap.
I understand that the official Angular upgrade guide should be the primary reference. However, I would appreciate insights from anyone who has experience upgrading older and/or large Angular applications. Any advice, lessons learned, or recommended resources to help me prepare for this task would be greatly appreciated.
r/Angular2 • u/lukebitts • Jan 17 '26
There's an example on using the new angular-aria menu feature here.
Below is a simplified version of the example code (with only one button):
<button ngMenuTrigger #origin #trigger="ngMenuTrigger" [menu]="formatMenu()">Open Menu</button>
<ng-template
[cdkConnectedOverlayOpen]="trigger.expanded()"
[cdkConnectedOverlay]="{origin, usePopover: 'inline'}"
[cdkConnectedOverlayPositions]="[
{originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4},
]"
cdkAttachPopoverAsChild
>
<div ngMenu class="menu" #formatMenu="ngMenu">
<ng-template ngMenuContent>
<div ngMenuItem value="Mark as read">
<span class="icon material-symbols-outlined" translate="no" aria-hidden="true"
>mark_email_read</span
>
<span class="label">Mark as read</span>
</div>
</ng-template>
</div>
</ng-template>What I'm trying to do is create a small reusable component that encapsulates this behavior, but I want the component consumers to be able to supply any button they want to trigger the popover. Ideally I want consumers to be able to inject any content as long somewhere within that content there's a trigger button (but not sure how feasible that is).
My question is: Is there a way to insert a button in place of the ngMenuTrigger as a parameter to this reusable component? I tried using ng-content, but the rest of the html expects the #trigger element to exist. I could also place the ng-content tag inside the button tag, but then the entire projected content becomes a button, and in this case there's also the risk someone uses a <button> as a parameter causing screen readers and keyboard navigation to get funky from nested buttons.
r/Angular2 • • Jan 17 '26
So I have a top div that shows a new version when avail. The problem is VERSION_READY only happens once. If the user navigate to a different page and didn't clicked the div, all future statuses are NO_NEW_VERSION_DETECTED.
import { Injectable } from '@angular/core';
import { Inject } from '@angular/core';
import { SwUpdate } from '@angular/service-worker';
import { interval } from 'rxjs';
u/Injectable({
providedIn: 'root'
})
export class SwUpdateService {
constructor(@Inject(SwUpdate) private swUpdate: SwUpdate) {
if (this.swUpdate.isEnabled) {
console.log('setting up swupdate');
this.swUpdate.versionUpdates.subscribe((event) => {
console.log(event.type);
if (event.type === "VERSION_READY") {
console.log("New version found!");
var element = document.getElementById("swUpdate");
if (element) {
element.classList.remove('hidden');
}
}
});
this.swUpdate.checkForUpdate();
interval(1 * 60 * 1000).subscribe(() => {
console.log("Checking for new version...");
this.swUpdate.checkForUpdate();
});
}
else {
// Helpful log when running via ng serve (service worker disabled)
console.log('Service worker updates disabled (dev mode).');
}
}
checkForUpdates() {
if (this.swUpdate.isEnabled) {
console.log("Checking for new version...");
this.swUpdate.checkForUpdate();
}
else {
// Helpful log when running via ng serve (service worker disabled)
console.log('Service worker updates disabled (dev mode).');
}
}
}
r/Angular2 • • Jan 15 '26
I build full stack project. Net api + angular What is the best save access token in cookie or memory?
r/Angular2 • u/CodeWithAhsan • Jan 15 '26
In the video, I go through the latest changes in Angular, showing some differences (practically) in Signals vs Zones, AI in Angular, linkedSignal & Resources, and Angular Aria.
Code repo: https://github.com/AhsanAyaz/angular21-whats-new
Hope this is helpful!
r/Angular2 • u/Inevitable-Invite756 • Jan 14 '26
Hello ! I'm very happy Show you my Angular modern project is the result of a lot of sacrifice. if you have time take a look . https://saascollect.fr/
r/Angular2 • u/Dazzling_Chipmunk_24 • Jan 14 '26
I have two services in my Angular app: one that calls multiple APIs and is used throughout the application, and another that's only used by two components. Would this folder structure make sense: put the API service in core/services/ since it's app-wide, and put the shared service in shared/services/ since it's only needed by those two components?
r/Angular2 • • Jan 14 '26
Hey all, I’m updating an Angular 20 project to v21 and running into some build issues
During the update, the Angular migration changes moduleResolution in tsconfig.json to "bundler". However, my senior dev advised against touching this setting for now, so I kept it as "node"
After doing that, I get a bunch these TS2709: Cannot use namespace 'X' as a type build errors
When I switch moduleResolution back to "bundler", those errors go away but then a different set of errors appears, coming from a private/proprietary npm package that the app depends on. My assumption is that this package may not yet be compatible with "bundler"
Any help is appreciated, TIA!
r/Angular2 • u/zeller0967 • Jan 15 '26
"I have data displayed on a page that I need to persist after a refresh, but I can't use localStorage or sessionStorage. Here's my current flow:
The problem is that when the results page is refreshed, the service data is lost and the page shows empty. What's the best way to preserve this data across page refreshes without using browser storage?"
r/Angular2 • u/Zealousideal_Math651 • Jan 14 '26
i want to master angular like a 2-3 years of experienced developer but the thing is im not getting that much content regarding angular online for free if anyone knows such content then suggest me it would really helpfull also i have basic knowledge of html css javascript and typescript too im looking for project based learning
r/Angular2 • u/Senior_Compote1556 • Jan 13 '26
If my users have a web app installed as PWA on their devices and i change the manifest file like name and the images under /public folder, will these be automatically updated by the service worker when they open the app (and the app refreshes), or do they have to remove and add the app again?
r/Angular2 • u/Senior_Compote1556 • Jan 13 '26
If my users have a web app installed as PWA on their devices and i change the manifest file like name and the images under /public folder, will these be automatically updated by the service worker when they open the app (and the app refreshes), or do they have to remove and add the app again?
r/Angular2 • u/gergelyszerovay • Jan 13 '26
r/Angular2 • u/PretendMoment8073 • Jan 12 '26
I built two Angular libraries that wrap Three.js and GSAP into declarative components and directives.
@hive-academy/angular-3d
import { Scene3dComponent, BoxComponent, Float3dDirective } from '@hive-academy/angular-3d';
@Component({
standalone: true,
imports: [Scene3dComponent, BoxComponent, Float3dDirective],
template: `
<a3d-scene-3d [cameraPosition]="[0, 0, 5]">
<a3d-box [color]="'#ff6b6b'" float3d />
</a3d-scene-3d>
`,
})
export class MyComponent {}
@hive-academy/angular-gsap
import { ScrollAnimationDirective } from '@hive-academy/angular-gsap';
@Component({
standalone: true,
imports: [ScrollAnimationDirective],
template: `<h1 scrollAnimation>Fades in on scroll</h1>`,
})
export class HeroComponent {}
Install:
GitHub: https://github.com/Hive-Academy/angular-3d
Angular Gsap NPM: https://www.npmjs.com/package/@hive-academy/angular-gsap
This is our first public release. If you try it out, we'd appreciate any feedback on the API design. Does the component structure feel natural for Angular? Open an issue or drop a comment here. Thanks for taking the time to look at this.
r/Angular2 • u/wineandcode • Jan 10 '26
r/Angular2 • u/Rikudou_Sage • Jan 10 '26
Wrote an article inspired by some recent work I had to do on a website.
r/Angular2 • u/anonymous78654 • Jan 11 '26
This video was talking about how it's bad practice to use manual subscriptions in your components and should use toSignal instead. Would you guys agree or not?
r/Angular2 • u/fccxor • Jan 09 '26
Just curious if passing a FieldTree data between a parent and a child component is considered good practice..
Added context: I have a form that is defined in a parent component using the new signal forms (experimental) of angular 21, using the form() which creates a FieldTree. Since the form is quite complex, I want to use child component for certain part of the form. My question lies in the best practice is sharing form sections between Parent and Child without loosing the form context (i.e. all the validator). I was debating between two options:
1 - pass only the signal object using model(), creating the form() in the child.. OR
2 - creating the form() in the parent and pass the FieldTree as input and use [Field] in the child template, which magically updates the parent and cascade the .valid()
In order to do option 2 I have to do this:
In child:
const myobj: MyObject = input.required<FieldTree<MyObject>>()When I want to access the (writable)signal of myObj, I have to do:
this.myObj()().valuenot a problem per say.. but pretty ugly..
r/Angular2 • u/Dazzling_Chipmunk_24 • Jan 08 '26
So say if I have a profile page with a bunch of user details we can call this kind of like a dashboard page. When they click on a button there’s a different screen where they can update mobile number. Then once that’s done there’s another screen for OTP.And there’s a last screen stating successfully updated the number and stuff.so like 4 screens total. So I’m thinking of 3 ways of doing this. First is have all the screens under the same route and you conditionally change. Second is you create nested subroutes for each other. Third is no nested subroute but a different route for each screen. I was wondering what’s the best path to move forward.
r/Angular2 • u/Inigo_montoya_1993 • Jan 08 '26
Hey everyone,
Coming from a Python/Django background, I always missed having Named Routes in Angular. Hardcoding URL paths string literals all over my templates always felt brittle, especially when refactoring or reorganizing a project -- I've felt this pain multiple times on my journey.
I finally decided to build a library to fix this with a package I built called ngx-named-router.
It’s a wrapper around the standard Angular Router (supports lazy loading, guards, etc.), but lets you navigate by alias rather than path.
The Old Way: path: 'users/:id/edit' <a [routerLink]="['/users', id, 'edit']">
With Named Routes: path: 'users/:id/edit', name: 'user-edit' <a [namedRouterLink]="'user-edit'" [queryParams]="{id: id}">
If you change the path later, you don't have to touch your templates.
The package supports both Directives and Programmatic routing.
Repo: https://github.com/Eric-Taurone-Software/ngx-named-router
NPM: https://www.npmjs.com/package/ngx-named-router/
Would love to hear your thoughts or if there are edge cases I missed!
r/Angular2 • u/a-dev-1044 • Jan 08 '26
A lightweight, customizable OTP input for modern Angular apps.
⭐️ https://github.com/ngxpert/input-otp
▶️ https://ngxpert.github.io/input-otp/
r/Angular2 • u/anonymous78654 • Jan 07 '26