I have below code:
<ul ng-init="urls = ['/home', '/news', '/contactUs']">
<li ng-repeat="url in urls>
<a class="current-page" href="{{url}}">
{{url}}
</a>
</li>
</ul>
For each <a>
tag in the ng-repeat
loop, if {{url}}
is qual to window.location.href.split('?')[0]
then I wants to print the current-page class for that <a>
tag. Else, it should not be shown.
In simple words I wants something like this: {{url || if(url == window.location.href.split('?')[0])}}
Is it possible with AngularJS ? Then how?