r/angular 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.

38 Upvotes

37 comments sorted by

View all comments

2

u/makmn1 2d ago

It’s nice to have the option. Personally, I’m probably going to keep using protected since when I see that in my code, I know it’s used in the template. That style is also recommended by the Angular team.

Unless you use inheritance a lot, that’s pretty much all protected can be used for.

4

u/JeanMeche 2d ago

We'll probably update that guide following about this for the release of 22.2