I am using an ng-if
on an element to hide it until a certain condition is met. However, the condition gets met in my controller but the element appears to still not be in the DOM when my jquery selector tries to find it. It appears to be lagging perhaps, or maybe I am doing something wrong.
My HTML:
<div ng-if="!aBreadNotSelected" ng-click="goBack()" id="goBack"><i class="fa fa-arrow-left"></i> <span id="goBackText">Go <u>Back</u> To Menu</span></div>
My Controller:
$scope.myFunc = function(){
$scope.aBreadNotSelected = false;
$("#goBack").css("left","0px");
}
myFunc
fires, I know it does because the rest of it which I excluded here gets executed. But jquery can't find $("#goBack")
even though it looks for it after aBreadNotSelected
goes to false, which should satisfy the ng-if
, so what is happening do you think?
:(
Edit: I know the jquery is fine because when I type $("#goBack").css("left","0px");
in the console after myFunc
fires, I get what I want.