r/angular • • 4h ago

What's one Angular feature you ignored for too long and now use everywhere?

For me it was signals. I kept putting it off because RxJS "worked fine", then I refactored one component and ended up deleting half my subscriptions.

Curious what it was for others: standalone components, the new control flow, defer blocks, SSR hydration...?

13 Upvotes

13 comments sorted by

7

u/ldn-ldn 4h ago

Angular Aria - it's quite good when you have to create custom components and want a solid base for them.

0

u/Advanced-Key5560 4h ago

Haven't tried Aria yet, mostly because I assumed it'd be another heavy UI library. Is it more like headless primitives where you bring your own styling? If so that's exactly what I've been missing for a few custom dropdowns.

1

u/ldn-ldn 4h ago

Yeah, it's a set of directives which add ARIA behaviours and you build your custom components on top of it. I used it together with CDK in my pet project https://github.com/Auxx/front-burner to create a UI similar to VS Code and WebStorm. Works really well.

5

u/Background-Focus8571 4h ago

Control Value Accessor. I thought it was some dark magic, but I realised it is quite handy when You want use a custom control in a form...

1

u/Advanced-Key5560 4h ago

Ha, same. I avoided CVA for ages and kept passing values around with @Input/@Output plus manual syncing. Once it clicked, custom controls just work with formControlName and validators like any native input. The boilerplate is still a bit ugly though, do you have a base class you reuse or write it fresh each time?

2

u/Background-Focus8571 4h ago

No, i use signal forms already, I don’t have to implement CVA, but FormValueControl.

11

u/WiktorVanKross 3h ago

Custom Injection Tokens. I was familiar with the concept of dependency injection, but mainly with services or existing tokens. But once I needed to provide value from a specific place, custom Injection Tokens turned out to be a lifesaver.

7

u/GLawSomnia 4h ago

Directives once you figure out how to use them with Di they are a game changer

2

u/JezSq 47m ago

Signals. Literally deleted many headaches and bugs.

1

u/tom-smykowski-dev 3h ago

resource chaining

1

u/toasterboi0100 3h ago

In case of most of the recent new APIs we started using them heavily the moment they turned stable-ish. 3 quarters of our components are signal-only now, old structural directives are completely gone in favour of built-in control flow, all of our input components are FormValueControls/FormCheckboxControls (CVAs are ass, good riddance), migrations to Signal forms are ongoing (I have declared a holy war against ReactiveForms, they have always been awful and they're even worse if you've embraced signals everywhere else. It's gonna take a while though), and migrations away from NgModules is also ongoing (probably 2/3rds done)

In the aforementioned cases we also pretty quickly outright mandated the use of the new APIs in all new components and strongly encouraged refactors of existing ones whenever someone touched their code for an unrelated reason.

The one thing that may eventually become this "ignored for too long and now use everywhere" are Resources. They don't fit neatly in how our codebase does things and so using resources usually requires a lot more code than doing it the old way. But with NgRx resource extensions, which fix some of our gripes with the Resource API (throwing if you read value() when the resource is in an error state, and resetting previous value while pending), I may give them a second chance.

And then there are other APIs we don't have much use for. We use defer blocks in a few places, but we don't have a reason to use them often, and we don't use any SSR/hydration, because that would require getting our BE teams (.NET) on board and that ain't happening, they're neck deep in more important work.

1

u/weinde 2h ago

Ngrx 🥲 I cant comprehend it

1

u/Parakoppl 4h ago

effect()

/s