如何使用Angular-Cli在不在/src/app中的文件夹中创建组件 [英] How to create component in folder that is not in /src/app with Angular-Cli
本文介绍了如何使用Angular-Cli在不在/src/app中的文件夹中创建组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够在/src/app/...外部的文件夹中创建组件,模块或服务.
I want to be able to create components or modules or services in folder external to /src/app/...
所以我尝试了ng g c ../mco/lib,但是失败了.
so i've tried with ng g c ../mco/lib but it fail.
我希望能够使用CLI在app外部文件夹中创建一个组件.
I want to be able to create with the CLI a component in folder external to app.
我该如何实现?
您可以更改AngularCli的appRoot,因此我在angular-cli.json中添加了"apps"数组中的一个属性"appRoot":"mco"
You can change the appRoot of AngularCli, so in angular-cli.json i've added in "apps" array, a property "appRoot": "mco"
推荐答案
更改AngularCli的appRoot.
Change the appRoot of AngularCli.
所以在angular-cli.json
So in angular-cli.json
"apps": [
{
"root": "src",
"outDir": "dist",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "tr",
"appRoot": "mco"
}
],
这篇关于如何使用Angular-Cli在不在/src/app中的文件夹中创建组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文