我已经安装了最新版本的节点,即6.10和angular-cli,我试图创建文件夹智能组件和模块,但是当我执行以下命令时,它无法执行此操作,它将会创建组件/模块,但内部' app /'文件夹:
ng generate module app.module/app.module
事件我尝试将 .angular-cli.json 中的prefix属性修改为空白,如下所示,但仍无法正常工作:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "app-cli"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
此外,我尝试删除属性本身,但它不起作用。请告诉我如何使用angular-cli命令行创建文件夹智能组件?这里发生了什么:
发生了这种情况:
我希望这种结构:
答案 0 :(得分:1)
只需删除tslint文件中的一些检查,如下所示:
"component-selector": [
true,
"app",
"element",
"kebab-case"
]
答案 1 :(得分:1)
在 angular.json 中 - 将前缀值更改为空格,如下所示:
"前缀":"",