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> 

live demo

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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -