简体   繁体   English

angular 7 在我创建新项目时不询问是否使用路由

[英]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.

相关问题 我可以在 angular 项目中同时使用散列(#)和非散列(#)路由吗 - Can I use hashing(#) and non hashing(#) routing both in angular project 在Angular项目中迭代JSON响应以创建新的$ scope obj,我可以在应用程序中使用 - iterate JSON response in Angular project to create new $scope obj i can use in the app 如何创建不使用路由的AngularJS SPA应用程序? - How can I create an AngularJS SPA application that does not use routing? 角形布线时我可以传递数据吗 - can I pass data when routing in angular 如何使用 Angular 路由? - How to use Angular routing? 为什么 Angular 不问我关于 CSS 和路由权限的问题? - Why Angular doesn't ask me about css and routing permissions? Angular 10 部署到Http服务器时路由不工作? - Angular 10 Routing Does Not Work When Deployed to Http Server? 在 angular 中路由返回时,引导轮播不会自动滑动? - Bootstrap Carousel does not auto-slide when routing back in angular? 每次使用角度控制器都会创建if的新实例吗? - Will each use of an angular Controller create a new Instance of if? 我在 angular 项目中有多个 ngFor 使用 trackBy:trackByFunction 与单个 function 或创建多个 function? - I have multiple ngFor in angular project use trackBy:trackByFunction with single function or create multiple function?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM