filter last records

0

Good, I'm a little lost with this since I do not control Angular Material .

I have created a table in which all the results that I currently have in JSON appear to me and I have to do a function in which I filter to show the last X records, where X is the number that I enter to show.

HTML

<list-account-movements layout="row" flex="100" filtro-selecionado="vm.filterSelected" filter-value="vm.Ultimos registros" layout-wrap></list-account-movements>

This is the form field

<input type="number" class="input2 inputPresonalizado2" ng-model="vm.lastMovement" maxlength="3"/>

and in the JS I have introduced the binding in the controller

bindings: {
   filtroSelecionado: '<',
   filterValue: '<'
 }

and I would like to know if creating the function of Angular as I collect the input data to pass the corresponding variable to show the last selected records. For example, if I have 25 records and I put to show the last 5 records pick up the value to perform the corresponding search to display them.

Thank you very much, best regards

    
asked by derek 11.01.2017 в 16:20
source

1 answer

1

What I do is to have an object in the controller and assign the value of the imput to the object.

          $scope.input = {};

and in the html you do this ...

          <input type="number" class="input2 inputPresonalizado2" ng-model="input.numero" maxlength="3"/>

With this, when wanting to get the input value in the controller, in this case we show it in console, you just do the following ....

          console.log($scope.input.numero);
    
answered by 11.01.2017 / 17:08
source