Create component to specific module with Angular-CLI

后端 未结 26 1674
既然无缘
既然无缘 2021-01-29 19:46

I\'m starting to use angular-cli and I\'ve already read a lot to find an answer about what I want to do...no success, so I came here.

Is there a way to create a componen

26条回答
  •  一个人的身影
    2021-01-29 20:09

    Add a component to the Angular 4 app using Angular CLI

    To add a new Angular 4 component to the app, use command ng g component componentName. After execution of this command, Angular CLI adds a folder component-name under src\app. Also, the references of the same is added to src\app\app.module.ts file automatically.

    A component shall have a @Component decorator function followed by a class which needs to be exported. The @Component decorator function accepts meta data.

    Add a component to specific folder of the Angular 4 app using Angular CLI

    To add a new component to a specific folder use the command ng g component folderName/componentName

提交回复
热议问题