mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
731 B
731 B
Documentation below is for CLI version 6. For version 7 see here.
Generating a route
The CLI supports routing in several ways:
-
We include the
@angular/router
NPM package when creating or initializing a project. -
When you generate a module, you can use the
--routing
option likeng g module my-module --routing
to create a separate filemy-module-routing.module.ts
to store the module routes.The file includes an empty
Routes
object that you can fill with routes to different components and/or modules. -
You can use the
--routing
option withng new
to create aapp-routing.module.ts
file when you create or initialize a project.