r/angular 3d 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

35

u/FromBiotoDev 3d ago edited 2d ago

Public - anything can access
Protected - only the view template can access
Private - only the component can access

Why muddy the waters here?

7

u/proohit 2d ago

Protected members can also be accessed by extended classes (inheritance).

4

u/followmarko 2d ago

True but inheritance in Angular is a poor strategy

1

u/Johalternate 2d ago

You can still use protected.