I have this property in a child component:
@Input() submitButtonDisabled: boolean;
In the template of my parent component I set it via property binding using interpolation:
<my-child-component
[submitButtonDisabled]="{{disableSubmitButton()}}">
</my-child-component>
The child component template reads its
submitButtonDisabled
property this way:
<button id="btSubmit" type="submit" (click)="submit()"
[disabled]="submitButtonDisabled">Ok</button>
Debugging my typescript code I see property binding working fine, but the submit button keeps disabled no matter what disableSubmitButton
returns (a boolean value). It seems the component is being rendered before the binding to take place.
Does this make any sense? Where is my mistake?
Reference: Angular 2 - Component Communication