mithun_daaon Stack Overflow • Recommends
On “What's the difference between @ViewChild and @ContentChild?”
This video from Angular Connect has excellent info about ViewChildren, ViewChild, ContentChildren and ContentChild
link to this video
@Component({
template: `
<my-widget>
<comp-a/>
</my-widget>
`
})
class App {}
@Component({
selector: 'my-widget',
template: `<comp-b/>`
})
class MyWidget {}
From my-widget 's perspective, comp-a is the ContentChild and comp-b is the ViewChild . CompomentChildren and ViewChildren return an iterable while the xChild return a single instance.