0

I am using ngTable v1.0.0. I have a filter select dropdown. Even when I set my default option to the filter to "something" it still creates an empty option tag which shows up as a blank value.

How do I get rid of this

this.tableParams = new NgTableParams({

     filter: { type: "2|3|6", userGroup: "", name: "" }
}

Screenshot attached Blank Option tag above default All selected value

How do I get rid of this?

Table HTML

 <td title="'Type'" filter="{type: 'select'}" 
filter-data="users.userTypes" header-class="'filter-select-dropdown'">
{{user.type}}
</td>

JS scope model

$scope.users.userTypes.push({'title': 'All', 'id': '2|3|6'});

    _.each(hl.userTypes, function(v, k) {
        if(k == 2 || k ==3 || k == 6) {
            $scope.users.userTypes.push({'id': k, 'title': v});
        }
    });
Neil
  • 2,802
  • 8
  • 34
  • 49
  • this might help you - http://stackoverflow.com/questions/12654631/why-does-angularjs-include-an-empty-option-in-select – Disha Jul 22 '16 at 07:12
  • Thanks, But I am setting the default value of the model. I am talking about the 2nd option tag in the screenshot the one with value="string:" – Neil Jul 22 '16 at 07:30
  • can you share your html and js code? – Disha Jul 22 '16 at 08:13
  • I think it is the same problem reported here: [ng-table select filters show double blank items in IE](https://stackoverflow.com/questions/44389303/ng-table-select-filters-show-double-blank-items-in-ie/44811479#44811479) – Carlos Coelho Jun 28 '17 at 19:57

0 Answers0