Create Component without folder

后端 未结 3 1264
野趣味
野趣味 2021-02-15 21:39

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

相关标签:
3条回答
  • 2021-02-15 22:12
    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 :)

    0 讨论(0)
  • 2021-02-15 22:17

    ng g c test1 --flat --inline-template --inline-style

    • --flat allows us to create the new component without new folder.
    • --inline allows us to keep the template/style in the component file itself instead of creating separate file for those.
    0 讨论(0)
  • 2021-02-15 22:28

    You can use --flat flag.

    ng g c test --flat
    

    For more information follow this link

    flat = true | false

    When true creates the new files at the top level of the current project.

    Default: false

    0 讨论(0)
提交回复
热议问题