I would like to disable my textbox when a checkbox is checked. Problem is, I can't even disable it in the first place without any condition.
This is my HTML:
<label for="checkbox-inline">
<input type="checkbox" class="checkbox other" name="others" value="15"
#goodsOthersChk (change)="onCheckArray($event, Form.value.goods)">
<p class="otherText"> Others:</p>
<input id="goodsOthers" name="goodsOthers"
formControlName="goodsOthers" type="text" value=""
class="form-control otherInput" size="30%" [disabled]="isDisabled">
</label>
my component.ts:
export class GoodsComponent implements OnInit {
isDisabled = true;
}
I don't see what I'm missing. When I inspect the textbox, it has a property of ng-reflect-is-disabled which is set to true but does not reflect on my page.
formControlNamedirective on it. The [disabled] property will not work with Reactive Forms. Use the disabled property on the FormControl in TypeScript instead.[disabled]property to disable a form control using reactive forms. Currently it gives a warning in console, later this will be deprecated and give errors.