AngularJs禁用指令未在ng-click上更新,但刷新后它将正常工作

时间:2017-12-26 13:02:05

标签: angularjs

当我点击Book按钮时,如果状态已被预订但未更新或禁用指令未更新,则应禁用按钮,但是当我刷新页面然后它工作正常并且按钮被更新



$scope.bookingData = function(){
    $http.post('myUrl',$scope.myRequiredParameters).
    then(function(response){
    	$scope.datas = response.data.data;//here i am getting my data successfully
    });
}
$scope.booked = function(){
	$http.post('myUrl',$scope.myRequiredParameters).
    then(function(response){
    	$scope.bookingData = response.data.data;//here also  i am getting my data successfully
    	$scope.bookingData();//here i am calling again bookingData function to update status in 
    });

}

<tr ng-repeat="data in datas" >
	<td >  
		
         <input type="button" class="btn btn-danger" 
          value="Cancel" ng-click="cancelled()" ng-disabled="data.status =='BOOKED' " >
           <input type="button" class="btn btn-success"
           value="Book" ng-click="booked()" ng-disabled="data.status ='BOOKED' ">
    </td>
     <td>
           <span class="col-md-2 col-xs-12 no-padding text-left-xs" >User Name. :- <b>{{data.name}}</b>   </span>   
            <span class="col-md-3 col-xs-12 no-padding text-left-xs">Name :-<b>{{data.status}}</b> </span>   
      </td>
 </tr>   
&#13;
&#13;
&#13;

0 个答案:

没有答案