How do you inherit the template from a parent component in angular 4?

前端 未结 2 812
长情又很酷
长情又很酷 2021-02-07 07:44

How would you inherit the template from a parent component in angular 4? Most materials exemplify overriding the parent component like this:

import { Component }         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-02-07 08:06

    Since you have a child component, you could place it in the parent's directory, and give it an URL that references the parent.

    @Component({
      selector: 'app-child',
      templateUrl: '../parent.component.html',
      styleUrls: ['../parent.component.scss']
    })
    

提交回复
热议问题