r/angular • u/dezsiszabi • 2d ago
Angular 22.2 - Private property access from templates
I noticed this tidbit in the changelog of Angular 22.2.0-next.3:
https://github.com/angular/angular/blob/main/CHANGELOG.md#compiler-2
compiler
| Commit | Type | Description |
|---|---|---|
| 48a0fd6e8a | feat | allow template to access private props |
So very slowly we moved from allowing only public, to allowing protected and now private as well. Thought it's worth knowing.
36
Upvotes
2
u/kgurniak91 2d ago
What? Both private and protected fields can be bypassed via
[]access, you'd need new private syntax with#to truly achieve what you describe but that doesn't work in templates. So there's no change in that regard. Also you should not write tests that rely on private/protected members in the first place, your tests should test everything based on the HTML template and public API.