1

I am trying using ng-if in my HTML

HTML

<td width=15% ng-if="value == I">Decision</td>  
<td width=10% ng-if="value != I">Status</td> 

JS

    $scope.value = "I";

I am getting $scope.value value in my HTML. But ng-if not working.

More infomation please lookout http://jsfiddle.net/n3xWB/1493/

Thanks.

2 Answers 2

3

Try ng-hide instead of ng-if and also you missed the quotes " 'I' "

<td width=15% ng-hide="value == 'I'">Decision</td>  
<td width=10% ng-hide="value != 'I'">Status</td>
Sign up to request clarification or add additional context in comments.

Comments

1

missed the quote around the ng-if values

<td width=15% ng-if="value == 'I'">Decision</td>  
<td width=10% ng-if="value != 'I'">Status</td> 

 
angular.module("app",[])
.controller("TodoCtrl",TodoCtrl )

 function TodoCtrl($scope) {

    $scope.value = "I";
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app">
  <div ng-controller="TodoCtrl">
       <table>
        <tr>
           value =================== {{value}}
            <td width=15% ng-if="value == 'I'">Decision</td>  
           <td width=10% ng-if="value != 'I'">Status</td> 
        </tr>

    </table>
  </div>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.