Hello,
In Angular 15, there was a deprecation of class-based Guards and Resolvers, which has sparked discussions regarding this decision. The deprecation of these interfaces is seen as a regression that goes against established software engineering practices. Some argue that there wasn’t sufficient discussion on the topic.
Deprecated: Class-based Route guards are deprecated in favor of functional guards. An injectable class can be used as a functional guard using the
inject
function:canActivate: [() => inject(myGuard).canActivate()]
Deprecated: Class-based Route resolvers are deprecated in favor of functional resolvers. An injectable class can be used as a functional guard using the
inject
function:resolve: {'user': () => inject(UserResolver).resolve()}
.
This move doesn’t seem right and I started an issue here https://github.com/angular/angular/issues/50234 and there’s also discussion about this here https://github.com/angular/angular/pull/47924.
To raise awareness and gather feedback from the community, I ask everyone to engage on the discussion.
Thank you.