Posts

Showing posts from January 27, 2019

Assign css class using ng-class in angular js

Image
3 I'm using angularjs and I have data like this : $scope.users = [{ name: "Pratik" queue: [{number: "199"},{number: "111"}], status: "OK" }] My view : .available{ background-color: #00226f; color: #f8f8f8; } <div class="col-xs-12 col-sm-3" ng-repeat="user in users"> <span ng-class="{'available': user.queue[0].number == 111}" class="badges ">111</span> </div> My problem is that I want to assign the class "available" if the queue array in users contains the number "111" at any index. In the users array the number:"111" may appear at any index so in the view I can't always use user.queue[1].number == 111 or user.queue[1].number