Home > Software engineering >  Filtering options from a md-select with multiple options checked
Filtering options from a md-select with multiple options checked

Time:02-10

I get the infos from a database and I put on a table. I have some filters, but i need to choose one or more options in a md-select. For only one option the filter worked fine, but when i set the "multiple" attribute, it doesn't work anymore.

The html:

<div ng-controller="resultController as ctrl" ng-cloak>
   <!-- some code here -->
   <md-input-container  flex="25">
      <label>Type of Account</label>
      <md-select name="accountFilter" ng-model="selectedAccount" multiple>
         <md-option ng-value="item" ng-repeat="item in ctrl.infosDB | unique: 'account'">
            {{item.account}}
         </md-option>
      </md-select>
   </md-input-container>
   <!-- some code here -->
   <table md-table ng-model="ctrl.infosDB" md-row-select="true"
      md-progress="promise">
      <thead md-head md-order="query.order" md-on-reorder="logOrder">
         <tr md-row>
            <th md-column>
               <span>Account</span>
            </th>
         </tr>
      </thead>
      <tbody md-body ng-repeat="item in ctrl.infosDB | filter:{ account: selectedAccount.account }">
         <tr md-row="item" md-select-id="id" md-auto-select>
            <td md-cell>{{item.account}}</td>
         </tr>
      </tbody>
    </table>
</div>

How can I code in order to keep the filter working with multiple options?

Thanks in advance!

CodePudding user response:

  •  Tags:  
  • Related