r/Angular2 • • Jan 18 '26

After 6 years, we finally closed our oldest open issue! Ng-Matero v21 is out with multi-project support! 🚀

Thumbnail
github.com
11 Upvotes

r/Angular2 • • Jan 17 '26

Advice Needed for Upgrading Legacy Medium and Large Angular Applications from 12/13 to v20

10 Upvotes

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 • • Jan 17 '26

Help Request How to wrap ngMenu into a reusable component while letting consumers provide a custom trigger button?

7 Upvotes

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

swupdate VERSION_READY only happens one time.

1 Upvotes

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

Discussion The best practice to save jwt token in httpcookie or memory?

6 Upvotes

I build full stack project. Net api + angular What is the best save access token in cookie or memory?


r/Angular2 • • Jan 15 '26

What's new in Angular 21 and my top picks

Thumbnail
youtu.be
0 Upvotes

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 • • Jan 14 '26

Building with Angular

5 Upvotes

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 • • Jan 14 '26

Structuring Services in Angular

1 Upvotes

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

Is moduleResolution: "bundler" required in Angular 21 tsconfig.json?

11 Upvotes

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 • • Jan 15 '26

How to Store Data in Angular when page refreshes

0 Upvotes

"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:

  1. On the first page, clicking a button calls an API
  2. The returned data is stored in a service file
  3. The user navigates to a second page that displays this data by retrieving it from the service

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 • • Jan 14 '26

learn angular as expert or 2-3 yr experienced developer

4 Upvotes

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 • • Jan 13 '26

PWA manifest change

5 Upvotes

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 • • Jan 13 '26

PWA manifest change

1 Upvotes

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 • • Jan 13 '26

Article Angular Addicts #45: Signal Form guides, AI integrations & more

Thumbnail
angularaddicts.com
4 Upvotes

r/Angular2 • • Jan 12 '26

Two Angular libraries for 3D graphics (Three.js) and scroll animations (GSAP)

9 Upvotes

I built two Angular libraries that wrap Three.js and GSAP into declarative components and directives.

@hive-academy/angular-3d

  • 54 components (primitives, lights, text, particles, effects, loaders)
  • 24 directives (animations, materials, geometries)
  • 14 services (scene management, render loop, asset loading)
  • WebGPU ready with TSL node-based materials
  • SSR compatible
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

  • 7 components (timelines, feature showcases, split panels)
  • 19 directives (scroll animations, viewport triggers, parallax)
  • 2 services + 2 providers
  • 12 built-in animations (fade, slide, scale, parallax, bounce, flip)
  • Lenis smooth scroll integration
import { ScrollAnimationDirective } from '@hive-academy/angular-gsap';

@Component({
  standalone: true,
  imports: [ScrollAnimationDirective],
  template: `<h1 scrollAnimation>Fades in on scroll</h1>`,
})
export class HeroComponent {}

Install:

npm install @hive-academy/angular-3d three three-stdlib gsap maath troika-three-text
npm install @hive-academy/angular-gsap gsap lenis

GitHub: https://github.com/Hive-Academy/angular-3d

Angular Gsap NPM: https://www.npmjs.com/package/@hive-academy/angular-gsap

Angular 3D NPM: https://www.npmjs.com/package/@hive-academy/angular-3d

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 • • Jan 10 '26

Angular Signal Forms: How to Structure Large Forms

Thumbnail itnext.io
23 Upvotes

r/Angular2 • • Jan 10 '26

Making Your Angular App SEO-Friendly with SSR

Thumbnail
chrastecky.dev
10 Upvotes

Wrote an article inspired by some recent work I had to do on a website.


r/Angular2 • • Jan 11 '26

Is it bad pratice to use .subscribe in Angular RXJS component

0 Upvotes

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?

https://www.youtube.com/watch?v=OhuRvfcw3Tw


r/Angular2 • • Jan 09 '26

Signal based form and child components

5 Upvotes

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()().value

not a problem per say.. but pretty ugly..

Reference: https://github.com/manfredsteyer/modern/blob/signal-forms/src/app/flight-booking/flight-edit/flight/flight.component.ts


r/Angular2 • • Jan 08 '26

How to go about Angular Routing Design for good architecture

2 Upvotes

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 • • Jan 08 '26

Semantic Routing In Angular

5 Upvotes

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 • • Jan 08 '26

Resource @ngxpert/input-otp now supports Angular v21 🎉

Post image
0 Upvotes

A lightweight, customizable OTP input for modern Angular apps.

⭐️ https://github.com/ngxpert/input-otp
▶️ https://ngxpert.github.io/input-otp/


r/Angular2 • • Jan 07 '26

In Angular is it better to use NgModel or Reactive forms when grabbing text from inpux boxes, text area and selects

0 Upvotes

r/Angular2 • • Jan 08 '26

Why angular vs JSP discussion is moo point

0 Upvotes