Create Component without folder

后端 未结 4 1481
长发绾君心
长发绾君心 2021-02-15 21:47

I need to create a component without the folder. I am using Angular-Cli command ng g c testing to create the component. But, the command creates an folder wrapper f

4条回答
  •  爱一瞬间的悲伤
    2021-02-15 22:06

    ng generate module app-routing --flat --module=app
    

    or

    ng g m app-routing --flat --module=app
    

    --flat creates the file in src/app instead of creating a folder. If you want to skip creating folder, you can use --flat flag

    --module=app tells the CLI to register it in the imports array of the AppModule.

    ng g c test --flat
    ng g c test --skipTests=true
    

    --skipTests=true is not to create any test files.

    hope you understood. Happy coding :)

提交回复
热议问题