0

I've got this code working nicely (see the code snipet as follows).

        <tr ng-repeat="diag in accidentsDiagnostics | filter:accidentsSearch(accidentSearchSelectedStage, accidentSearchSelectedOrgan, accidentSearchSelectedSymptom)">
            <td>{{diag[3]}}</td>

Is it possible to set a new model variable in the scope with the results (array), any time a new request is performed as the result of the user selection?

Stéphane de Luca
  • 12,745
  • 9
  • 57
  • 95

2 Answers2

1

Yes, you can save the filter results to your scope/model by adding an assignment to your repeat expression:

ng-repeat="diag in filtered = (accidentsDiagnostics | filter:accidentsSearch(...) )"

More info is available in this related question.

Community
  • 1
  • 1
j.wittwer
  • 9,497
  • 3
  • 30
  • 32
0

You can do the filtering in your controller and save it there (don't forget to inject the $filter service into the controller).

$filter('accidentsSearch')(dataToFilter)

See https://stackoverflow.com/a/14302334/725752

Community
  • 1
  • 1
Spencer
  • 2,245
  • 3
  • 28
  • 50