i sitting on issue trying figure out , unexpectedly did worked! :)
but have no idea why working??
would appreciate if explain me.
what wanted was: using id values determine whether button should display or not, :
if id == 1 button should shown.
and if id >= 2 button should hidden.
and have event toggle id's manually , button shows/hides correctly change values.
html
the thing boggles me ng-show="s == ph[0].phaseid"
because, in explanation said should determined id's. , coding not (in sense) show compares value correct id's.
<button ng-if="ph" type="button" class="col button button-small button-dark" ng-init="showme(ph);" ng-show="s == ph[0].phaseid"> check in </button>
javascript
$scope.showme = function() { $scope.s = true; }
as rule of thumb test exact code put inside ng-show
(or ng-if
or ng-hide
) , verify in condition evaluates true
. in case $scope.s = true
expression s == ph[0].phaseid
evaluate true
. why? because ==
works little different in other languages, here need ===
.
for example true == 1;
evaluates true
true === 1;
evaluates false
. here better reference.
try change ==
===
Comments
Post a Comment