mercredi 30 août 2017

ng-style and ng-disabled initially evaluate as true even though boolean is false in ng-repeat?

I'm running into a strange problem with ng-style and ng-disabled in the context of an ng-repeat. I have the following template...

        <li ng-repeat="value in currentFacet.values track by $index">
          
          <input type="checkbox" ng-model="options[$index]" ng-true-value="''" ng-checked="value.isActive" ng-disabled="showAll"/>
          <span ng-style="showAll ? {color:'gray'} : {}"></span>
        </li>

Which produces a list of checkboxes. There is a showAll boolean which disables all of these checkboxes.

Initially when the page loads it seems that ng-style and ng-disabled evaluate as if the boolean had been true...even though when I viewed the current status of the boolean (That's why that is in there) it was false.

If I change the boolean to true and then back to false the functionality works as expected. It is only on the initial page-load that this udnesired behavior occurs.




Aucun commentaire:

Enregistrer un commentaire