I was trying to do something like
$timeout(function() {
if (someCondition === true) {
_this.isVariantShowSaving = true;
}
}, 50);
in a controller (note:I used controllerAs syntax saved var _this = this;
) that related to a dom that has follow properties
class="pricing-info" ng-class="{ 'pricing-info variant-hide-savings' : !expressDealCtrl.isVariantShowSaving }"
for some reason the class="pricing-info"
has been completely wiped, when isVariantShowSaving
toggled form false to true by the timeout....
I can't imagine what is the issue. Thought?
Problem is NOT with $timeout
for in any case there is in need for two different expressions, one should always do
<div ng-class="{class1 : expression1, class2 : expression2}">
Hello World!
</div>
in my case expressDealCtrl.isVariantShowSaving
and ! expressDealCtrl.isVariantShowSaving
are TWO expressions.
*Spent at least 4 hours on this... hope it helps someone :)
Cheers!