Update defaults for guards and resolvers to be functional guards#24182
Update defaults for guards and resolvers to be functional guards#24182atscott wants to merge 4 commits intoangular:mainfrom
Conversation
…outer guards Functional guards were introduced in the Angular router in v14.2. This commit adds the ability to generate functional router guards by specifying `--guardType` instead of `--implements`. These guards are also accompanied by a test that includes a helper function for executing the guard in the `TestBed` environment so that any `inject` calls in the guard will work properly. DEPRECATED: The 'implements' flag is deprecated. Use 'guardType' instead.
…outer resolvers Functional resolvers were introduced in the Angular router in v14.2. This commit adds the ability to generate functional router resolvers by specifying `--functional`. These resolvers are also accompanied by a test that includes a helper function for executing the resolver in the `TestBed` environment so that any `inject` calls in the resolver will work properly.
This commit updates the guard schematic to prompt for the type of guard to generate rather than the interface. This will generate a functional guard. Class-based guards will be deprecated in v15.1: angular/angular#47924
This commit updates the resolver schematic to generate functional resolvers by defualt. Class-based resolvers will be deprecated in v15.1: angular/angular#47924
|
Hi @atscott, We did discuss this PR during our last triage meeting and while we do not guarantee that the generated code does not change between versions. This is too big of a change to be done outside of a major. We suggest a call out in the deprecation note so users can opt-in and use the non deprecated code template by default Feel free to close the PR or rebase it and make the necessary changes to eventually land in v16. I also have a separate PR to add an aliased for the |
|
Closing in favor of #24585 |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
first two commits are part of #24170.
The two commits specific to this are the default updates, which may be considered a breaking change.