问题描述
我将Angular 4与Angular CLI结合使用,并且能够使用以下命令创建新组件.
E:\ HiddenWords> ng生成组件明示
但是我需要在Plainsight内部生成一个子组件.有没有办法使用Angular CLI做到这一点?
使用我们的 ng g组件plainsight/some-name
会创建一个新目录./p>
最终输出将是:
plainsight/some-name/some-name.component.ts
为避免这种情况,请使用扁平选项 ng g组件plainsight/some-name --flat
,它将不生成文件而生成文件
plainsight/some-name.component.ts
I am using Angular 4 with Angular CLI and I am able to create a new component with the following command.
E:\HiddenWords>ng generate component plainsight
But I need to generate a child component inside plainsight. Is there a way to do it with Angular CLI?
The ng g component plainsight/some-name
makes a new directory when we use it.
The final output will be:
plainsight/some-name/some-name.component.ts
To avoid that, make use of the flat option ng g component plainsight/some-name --flat
and it will generate the files without making a new folder
plainsight/some-name.component.ts
这篇关于如何使用Angular CLI在特定文件夹中生成组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!