In my angular template, I have a basic ng-repeat with some div elements. Now, I am looking to add a class to a specific div if the $routeParams.userId
matches the id of the object in the loop. You can refer to the second line of code below for clarification.
<div class="row" ng-repeat="contact in contacts">
<div class="col-xs-12 contact-wrapper {{ if ($routeParams.userId == contact.id){ print 'active' } }}"> <!-- <== SOMETHING LIKE THIS -->
{{ contact.user_name }}
<br />{{ contact.last_pm_text }}
</div>
</div>
Is there a way to assign the class active
to the div when contact.id
matches $routeParams.userId
? Any suggestions or solutions would be greatly appreciated!