 <p>You can achieve this by updaing your controller function as :</p> <pre><code> vs.selectTag = function(term,k) { if(vs.toggleTags.item.indexOf(k) == -1){ vs.toggleTags.item.push(k) } else { vs.toggleTags.item.splice(vs.toggleTags.item.indexOf(k),1); } alert(term +' in tag #'+ vs.toggleTags.item); }; </code></pre> <p>And update html to:</p> <pre><code>&lt;li ng-repeat="(k, m) in tags" ng-class="{'selected':toggleTags.item.indexOf(k) &gt; -1}" ng-click="selectTag(m.name,k)"&gt; &lt;div class="tag"&gt;{{m.name}}&lt;/div&gt; &lt;/li&gt; </code></pre>