I want to use content projection, but I can't bring it to work.
The HTML is
<form [ngFormModel]="demoForm" (ngSubmit)="onSubmit()">
<my-form-group myLabel="Some Label">
<input type="text" [ngFormControl]="demoForm.controls['someInput'] [required]="true">
</my-form-group>
</form>
The Component is
@Component({
selector: 'my-form-group',
template: `
<div class="form-group">
<label>{{myLabel}}<span *ngIf="required"> *</span></label>
<ng-content></ng-content>
</div>
`
})
export class MyFormGroup {
@Input() myLabel: string;
}
How can I bind the *ngIf condition in the span to the required property of projected input element? The goal is to show the asterisk in the outer component, when [required] becomes true.
Edit: I made a - not working - plunkr to show what I mean.