Disable Button in Angular 2

后端 未结 2 1024
忘了有多久
忘了有多久 2021-02-06 20:17

I want if the input \'Contract type\' is empty, the button \'Save\' is not clickable

Save button:

相关标签:
2条回答
  • 2021-02-06 20:39

    I tried use [disabled]="!editmode" but it not work in my case.

    This is my solution [disabled]="!editmode ? 'disabled': null" , I share for whom concern.

    <button [disabled]="!editmode ? 'disabled': null" 
        (click)='loadChart()'>
                <div class="btn-primary">Load Chart</div>
        </button>
    

    Stackbliz https://stackblitz.com/edit/angular-af55ep

    0 讨论(0)
  • 2021-02-06 20:54

    Change ng-disabled="!contractTypeValid" to [disabled]="!contractTypeValid"

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