1.创建组件
ng g c my-first-componet,默认生成以下四个文件
此时selector中是app-my-first-componnet,前面多了个app,是因为在文件angular.json中设置了前缀
2.引用组件
在app.component.html添加标签<app-my-first-componnet></app-my-first-componnet>
ng g c my-first-componet,默认生成以下四个文件
此时selector中是app-my-first-componnet,前面多了个app,是因为在文件angular.json中设置了前缀
在app.component.html添加标签<app-my-first-componnet></app-my-first-componnet>