[英]angular 7 does not ask if to use routing when i create a new project
I was formerly using Angular version 6, now I have upgraded to 7. But when I try to create a new project in CLI using ng new [app-name]
it just starts without asking if I want to include routing in my project or the styling.我以前使用 Angular 版本 6,现在我已经升级到 7。但是当我尝试使用ng new [app-name]
在 CLI 中创建一个新项目时,它只是开始而不询问我是否想在我的项目中包含路由或造型。
PS: I have the latest version of Angular ie 7.0.2. PS:我有最新版本的 Angular 即 7.0.2。
ng new {Project-name}
command by default creates project without routing. ng new {Project-name}
命令默认创建没有路由的项目。
You need to set routing flag as true while creating project as below(by default this routing flag will be false),您需要在创建项目时将路由标志设置为 true,如下所示(默认情况下,此路由标志将为 false),
ng new {Project-name} --routing=true
Go through angular documentation for more details浏览 Angular 文档以获取更多详细信息
ng new --help
run this command this will open up the things you can do while creating project. ng new --help
运行此命令,这将打开您在创建项目时可以做的事情。
Lets say I wanna create Angular project with routing and .scss styles then I would do it by the following command.假设我想创建具有路由和 .scss 样式的 Angular 项目,然后我将通过以下命令来完成。
ng new project-name --routing=true --style=scss
I don't know why but when I tried to initialize the project using git bash on windows it doesn't prompt the questions about routing and style sheets.我不知道为什么,但是当我尝试在 Windows 上使用 git bash 初始化项目时,它不会提示有关路由和样式表的问题。 However, when I tried to use the same command in the terminal inside de VS code it worked.但是,当我尝试在 de VS 代码内的终端中使用相同的命令时,它起作用了。 It's strange since both terminals runs with bash.这很奇怪,因为两个终端都使用 bash 运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.