angularjs - ng-repeat add style on querystring -
i trying add class active on list of li elements being generated angularjs if current li key field equal id parameter in querystring. kind of behavior:
foreach person in people { if person.id = urlparameter.id { writeline <li id=person.id class="active">person.name<li/> } else { writeline <li id=person.id class="">person.name<li/> } }
the first issue how return value of query string parameter , secondly how use add in ng-repeat add class conditionally. appreciated
this answer shows how url parameters
then if have $scope.people , $scope.idfromurl defined in controller html should want
<li ng-repeat="person in people", ng-class="{'active':person.id==idfromurl}" > {{person.name}} </li>
Comments
Post a Comment