I am trying to define some html in my parent component that can be passed to the child component. Is this possible? I have tried a couple of things like this: How to pass an expression to a component as an input in Angular2?, but I did not have any luck. Maybe my syntax was wrong. I was a little confused with the let
. Appreciate all the help and any explanations to help me understand this better.
@Component({
selector: 'app-my-parent',
template: `
<div>other parent html</div>
<app-my-child [property]="value">
<ng-template #someTemplate">value.first</ng-template>
</app-my-child>
<app-my-child [property]="value">
<ng-template #someTemplate">value.second</ng-template>
</app-my-child>
`
})
export class MyParent {
}
@Component({
selector: 'app-my-child',
template: `
<div>other child html</div>
how do I access the template from here? Is there a way to do binding with templates?
})
export class MyChild {
@Input() property;
}