首页 > 解决方案 > 在 HTML 页面上交错组件

问题描述

我是 Angular 的新手。

我有一个很大的外部组件(从一些外部库导入),它呈现图像和导航链接以及标题组件。

我创建了一个新组件,并希望在呈现上述组件的部分中添加。

如何控制上述组件的定位?

标签: angular

解决方案


在要加载的组件中添加新组件的 HTML 选择器。

新组件

@Component({
  selector: 'app-home', \\this is the html selector
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})

HTML

<app-home></app-home>  //add this in the old component HTML page

推荐阅读