Open
Description
Command
generate
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
when using the new way provideRouter
the command ng g m foo --route=foo -m=app
stop working
Minimal Reproduction
create new angular 15 project
in app-routing.module.ts
- remove
AppRoutingModule
- export the
routes
const
in app.module.ts
- remove
AppRoutingModule
fromimport
array - add
provideRouter(routes)
to theproviders
array
then in the command line run ng g m foo --route=foo -m=app
Exception or Error
Couldn't find a route declaration in /src/app/app-routing.module.ts.
Use the '--module' option to specify a different routing module.
Your Environment
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1500.5
@angular-devkit/build-angular 15.0.5
@angular-devkit/core 15.0.5
@angular-devkit/schematics 15.0.5
@angular/cli 15.0.5
@schematics/angular 15.0.5
rxjs 7.5.7
typescript 4.8.4
Anything else relevant?
changing the file name from app-routing.module.ts
to routes.ts
gives a different but similar error message
Couldn't find a route declaration in /src/app/app.module.ts.
Use the '--module' option to specify a different routing module.