ng-disabled not working with bootstrap buttons

前端 未结 2 1515
Happy的楠姐
Happy的楠姐 2021-01-05 14:11

I am using bootstrap.js along with angular js, my code is following-

//few lines from controller
$scope.isWaiting = true;
$scope.promise = $http.get(\"voluu         


        
相关标签:
2条回答
  • 2021-01-05 14:24

    You need to give an expression to ng-disabled, instead you are giving a string("true"/"false") which is always truthy and button is always disabled.

    isWaiting --> expression

    {{isWaiting}} --> value of expression

    In your case:

    ng-disabled="isWaiting"
    
    0 讨论(0)
  • 2021-01-05 14:30

    If you are using ng-disabled an expression must be used that returns a truthy value. An example of an expression is isWaiting. {{isWaiting}}will instead output an expression. So instead use ng-disabled="isWaiting".

    <button class="btn btn-warning" ng-disabled="isWaiting">Report</button>
    

    ngDisabled documentation

    Expressions documentation

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