angularjs - How to `switch` the content by condition -
in ng-repeat, require dom switched, according active status.
i tried this, not working me:
<ul> <li ng-click="activate(item)" ng-repeat="item in items" ng-class="{active : active == item}"> <span ng-if="item==active"> <span>{{item}}</span><!-- when active nested under span --> </span> <!-- else without nesting span --> <span ng-if="item== !active">{{item}}</span> //this not working </li> </ul>
replace last ng-if statement (you've made syntax error):
<span ng-if="item !== active">{{item}}</span> your active variable isn't boolean, can't toggle in statement.
Comments
Post a Comment