Hi Ashim,

In my end your code works perfectly. I have create a plunker for the same. 
Please refer below link.

https://plnkr.co/edit/B2xYh9YBiunP51Xl0sgb

Here I assume your getTags() works to fetch all tags.

Hope it works for you.

Thanks

On Wednesday, March 2, 2016 at 9:25:49 PM UTC+5:30, Ashim G wrote:
>
> Hello 
> im new to angular. im gettin static from ng-repeats dupes error. ive tried 
> 'track by $index' to no avail.
> the foll is my JSON
>
>     
> {
>     "expression": "mithrandir",
>     "meaning": "language of the Elves",
>     "example": "",
>     "pronunciation": "",
>     "notes": "",
>     "meta": {
>     "book": "There and back again",
>     "author": "Frodo Baggins",
>     "tags": ["middle earth", "elves"]}
>     }
>
>
>
>
>
> I wish to populate the unique tags in a dropdown. 
> template is as follows:
>
>
> <https://lh3.googleusercontent.com/-Be4DKlZUMqc/VtcM6IsBU7I/AAAAAAAAAGM/qFE9HEiy5As/s1600/app.png>
>
>
>
> the view is as follows:
>     
> <md-input-container>
>     <label>Tags</label>
>     <md-select ng-model="tag">
>     <md-option ng-repeat="tag in tags" value="{{ tag }}"> 
>     {{ tag }} 
>     </md-option>
>     </md-select>
>     </md-input-container>
>
>
> the foll is the code in the controller:
>
>     
> classifiedsFactory.getClassifieds().then(function(classifieds) {
>  $scope.classifieds = classifieds.data; 
>  $scope.tags = getTags($scope.classifieds); // call the getTags method 
> below
>  // console.log($scope.tags)
>  
>  });
>
> .
> .
> .
>
>
>     function getTags(classifieds) {
>  
>  var tags = [];
>  angular.forEach(classifieds, function(item) {
>  angular.forEach(item.meta.tags, function(tag) {
>
>
>  tags.push(tag);
>  });
>
>
>  });
>  // console.log(_.uniq(tags))
>  return _.uniq(tags);
>  
>  }
>
> Im getting the foll console error:
>
>
> <https://lh3.googleusercontent.com/-88YU-PmEFho/VtcMlXUSbqI/AAAAAAAAAGE/NYpyBwXslno/s1600/console.png>
> [Console error][2]
>
>
> The foll is the github link:
>
> https://github.com/sfumatostar/ngclassifieds/blob/End_of_Section_7/components/classifieds/classifieds.ctr.js
>
> I'd appreciate your help in trying to get this fixed.
>
>
>   [1]: http://i.stack.imgur.com/8wi3m.png
>   [2]: http://i.stack.imgur.com/zHOIQ.png
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to