Disabled not working

前端 未结 3 1338
臣服心动
臣服心动 2021-02-20 16:00
  1. Not working :
    • [disabled] = true ,
    • [disabled] = \"isDisabled\" -----ts > ( isDisabled=true)
    • basic html disabler al
相关标签:
3条回答
  • 2021-02-20 16:24

    When using attr.disabled, you have to supply the literal value, or omit the attribute altogether. Bear in mind that the disabled attribute in HTML disables an element that supports the attribute simply by being present.

    <input [(ngModel)]="osoba.ime" [attr.disabled]="disabled?'':null" name="ime" type="text" id="ime">
    

    Both of the following in HTML should result in an input being disabled...

    <input disabled />
    <input disabled="disabled" />
    
    0 讨论(0)
  • 2021-02-20 16:27

    Use this :

     <input
        type="radio"
        id="primaryIPV6"
        value="2"
        [attr.disabled]="flagValue ? '' : null"
        formControlName="p_ip_type"
        (change)="optionalFn()">
    
    0 讨论(0)
  • 2021-02-20 16:35

    In the reactive form creation, you can add as below

    this.form= this.formBuilder.group({
          name: [{value: '', **disabled**: **true**}],
        });
    

    the form value will be disbaled

    0 讨论(0)
提交回复
热议问题