Dynamic string split while binding data in angularJS
<p>I am trying to implement <a href="http://www.w3schools.com/howto/howto_css_contact_chips.asp" rel="nofollow noreferrer">chips style</a>.
Adding tags and remove tags like chips style to an item, for that I need to split string and bind separately based on length of array of split.</p>
<p>How to split comma speared dynamic length string while binding data.</p>
<p><strong>how can I use angular filters here</strong><br />
Please check following code.</p>
<p>JS: Controller:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('myApp',[]);
app.controller('myCtrl', function($scope) { 
  var temp= {
  "values": [
    {
      "id": "1",
      "tags": "Design research, UI Frameworks, Wireframes" 
    },
    {
      "id": "2",
      "tags": "Hockey, basketball, Cricket, Football, Baseball"
    },
    {
      "id": "3",
      "tags": "Sensors, maps, Location Service, Studio"      
    },
  ],
  "count": "3"
};
 // I have json like this
 $scope.items = temp.values; 
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"&gt;&lt;/script&gt;
&lt;body ng-app="myApp" &gt;
&lt;div ng-controller ="myCtrl"&gt;
  &lt;p ng-repeat="item in items"&gt;
  &lt;span&gt;{{item.tags}}&lt;/span&gt;
  &lt;/p&gt;
  &lt;/div&gt;
  &lt;hr&gt;
  &lt;!-- here  I am trying implement chips style --&gt;
  &lt;!-- Requieremrnt--&gt;
  &lt;span style="background:#ddd;"&gt;{{item.tags[0]}}&lt;/span&gt;
   &lt;span style="background:#ddd;"&gt;{{item.tags[1]}}&lt;/span&gt;
  &lt;span style="background:#ddd;"&gt;{{item.tags[n]}}&lt;/span&gt;
  &lt;!-- can I use ng-repeat or custom filter. if yes how??--&gt; 
  &lt;hr&gt;
  &lt;/body&gt;</code></pre>
</div>
</div>
</p>
<p>Can I use ng-repeat or custom filter. if yes how??</p>
<p>Thanks.</p>