在HTML页面上交织组件

时间:2019-05-28 04:08:57

标签: angular

我是Angular的新手。

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

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

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

1 个答案:

答案 0 :(得分:0)

在要加载的组件中添加新组件的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