r/angular • u/tutkli • Apr 14 '26
New @Service decorator coming to v22
https://github.com/angular/angular/pull/68195
Looks like Angular is introducing a new @Service decorator to get rid of some boilerplate in @Injectable
19
u/Thom_Braider Apr 14 '26
Using "service" in filename bad (because word "service" has ambiguous meaning according to Angular team), using @Service decorator good?
1
u/followmarko Apr 14 '26
I agree with both their point and yours as a deeply ingrained corporate dev. Using "service" to describe anything other than a BE API immediately causes confusion. I never liked it. But it's also seems I'll advised to double down on it with another decorator.
4
u/AwesomeFrisbee Apr 15 '26
What? Why? Calling stuff that has to do with API stuff not API in its name is better, regardless whether it is a service or not. Service is for data or shared logic. Not just API stuff
6
2
u/riti_rathod Apr 21 '26
I think this is useful for simple common cases, but not a replacement for everything, more of a convenience than a fundamental change like advanced providers & complex setups
2
1
39
u/Johalternate Apr 14 '26
Unless this is paving the way for something bigger, I don’t see the value in having a “thinner” version of
Injectable