External filter on ng-table

0

I'm new to using AngularJS and ng-table and I'm having a small problem.

I want to learn how to create filters outside of the generated table, but I did not find anything about them on their site link .

If it makes a difference, the filter I want to create is a title filter, but outside the tag "table".

My code is working fine, but I want to do an external filter.

JS Code

TemasCtrl.$inject = ['$http', '$resource', 'ngTableParams', '$timeout'];

function TemasCtrl($http, $resource, ngTableParams, $timeout) {

    var temas = this;

    temas.carregarTabela = function () {

        var Api = $resource('/temas');

        temas.loading = true;

        temas.tableParams = new ngTableParams({
            page: 1,
            count: 10,
            sorting: {
                name: 'asc'
            },
            filter: {}
        }, {
            total: 0,
            getData: function ($defer, params) {
                Api.get(params.url(), function (data) {

                    $timeout(function () {

                        params.total(data.total);
                        $defer.resolve(data.itens);

                    }, 500);
                });
            }
        });
    }

}

HTML Code

<div class="ui attached segment" ng-init="temas.carregarTabela()">

     <table ng-table="temas.tableParams" show-filter="true" class="ui selectable compact table">
          <tbody>
               <tr ng-repeat="tema in $data">
                    <td class="ui center aligned collapsing" data-title="'ID'" filter="{ 'id': 'text' }">{{ tema.id }}</td>
                    <td class="ui collapsing" data-title="'Slug'" filter="{ 'slug': 'text' }">{{ tema.slug }}</td>
                    <td data-title="'Título'" filter="{ 'titulo': 'text' }">{{ tema.titulo }}</td>
               </tr>
          </tbody>
     </table>
</div>

Thanks for the help!

    
asked by anonymous 28.06.2016 / 19:57

1 answer

0

I think this will help you a lot:

link

    
01.07.2016 / 20:15