Answer the question
In order to leave comments, you need to log in
How to get a reference to the current DOM element from Angular Expression?
Good afternoon.
I can’t find any information on how to get a reference to the home element in the attribute of which it is used from Angular Expression.
<div ng-controller="DemoCtrl">
<ul>
<li><a demo-id="15" ng-class="{active: arDemos['demo-id'] == ????????}">Привет {{arDemos['demo-id']}}</a></li>
</ul>
</div>
Answer the question
In order to leave comments, you need to log in
Make the $scope.activeDemo property in DemoCtrl, and store the active element there, or its ID. Then it will be much easier to do this:
<li><a demo-id="15" ng-class="{active: arDemos['demo-id'] == activeDemo}">Привет {{arDemos['demo-id']}}</a></li>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question