【发布时间】:2018-09-01 14:21:46
【问题描述】:
如果我在我的 Angular4 父组件中使用 templateUrl,我需要包含
父模板中的子组件,如<child></child>,
我怎样才能达到同样的效果?
@Component({
selector: 'parent',
templateUrl: './foo.parent.html'
})
export class ParentComponent {}
子组件
@Component({
selector: 'child',
template: `
<h4>Child Component</h4>
`
})
export class ChildComponent {}
【问题讨论】:
-
请注意,您的应用组件选择器的名称应以
app-...开头(例如:app-parent)
标签: angular angular2-directives