Angular ng-show (or ng-if) not updating when value changes

I have a simple example in plunker . I have ng-show for one item and select as another item. The selection should toggle showing / hiding another (input) element. Initially setting to Yes shows another input element as expected. Then, setting the value to No switches the scope value to false as expected, but does not hide the input element.

I have looked at other posts related to this and the ones I found are related to {or} the absence of {{}} on the ng-show (I am not the way it should be) or not having a value on the $ volume (which I do ). I thought it might be a $ scope.apply () problem, but then why does the first change to Yes work? Also, adding the app still doesn't make the No (false) work. What am I missing?

TIA!

var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.conf = {};
});

      

+3


source to share


1 answer


You need to check ng-show = "conf.is_ieee == 'true'" instead of ng-show = "conf.is_ieee" . Check out this plunker.



<div class="col-md-4" ng-show="conf.is_ieee=='true'">
    <label class="form-label">IEEE Conference ID:</label>
    <input type="text" class="form-control" name="ieee-id" ng-model="conf.ieee_id"/>
  </div>
      

Run code


http://plnkr.co/edit/MXvuhSPB0ChJyDrvPI55?p=preview

+5


source







All Articles