javascript - Ng-table select filtering issue -
i trying filter ng-table data select drop down, issue select dropdown values not populating , ofcos filtering doesn't work, using ng-table 2.1.0 version. tried changing $scope.names object hardcoded object i.e., $scope.names=[{title:'moroni'},{title:'enos'},{title:'jacob'}];
values populating in select dropdown assuming there must property 'title' every object, still filtering doesn't work either, there missing here? plunker here
any appreciated.
as can see expression in ngoptions
attribute:
ng-options="data.id data.title data in $selectdata"
the format of option should {id: ..., title: ...}
. think can change angular.foreach
block this:
var titles = data.map(function(obj) { return obj.title; }); $scope.names = titles.filter(function(title, i) { return titles.indexof(title) === i; }) .map(function(title) { return {title: title, id: title}; });
this not fastest method generate array (added illustrate structure). more performant ways could found here.
wiki
Comments
Post a Comment