[英]How to put a component inside another component's templateUrl in Angular2+?
If I am using templateUrl in my Angular4 parent component, and I need to include 如果我在Angular4父组件中使用templateUrl,并且需要包含
the child component inside parent's template like <child></child>
, 父级模板中的子级组件,例如<child></child>
,
how can I achieve the same? 我怎样才能达到相同的目的?
@Component({
selector: 'parent',
templateUrl: './foo.parent.html'
})
export class ParentComponent {}
Child Component 子组件
@Component({
selector: 'child',
template: `
<h4>Child Component</h4>
`
})
export class ChildComponent {}
在foo.parent.html
文件中添加<child></child>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.