I'm running a simple ng-repeat
over a JSON file and want to get category names. There are about 100 objects, each belonging to a category - but there are only about 6 categories.
My current code is this:
<select ng-model="orderProp" >
<option ng-repeat="place in places" value="{{place.category}}">{{place.category}}</option>
</select>
The output is 100 different options, mostly duplicates. How do I use Angular to check whether a {{place.category}}
already exists, and not create an option if it's already there?
edit: In my javascript, $scope.places = JSON data
, just to clarify
db.collection.distinct("places")
, which was far, far better than doing it in within Angular! Sadly this won't work for everyone. – Thistledown