I am trying to use ngTable with angularJS.
I have installed all angular staff and It´s works well.
Now, I need to use ngTable.
I am using the next code but my http get is never triggered.
What am I missing here?
My code:
angular.module('clinang', ['ngTable']).controller('pacientesCtrl', function($scope,$http,NgTableParams){
this.tableParams = new NgTableParams({
page: 1,
count: 10
}, {
getData: function($defer, params) {
$http.get('/getdadospac/?oper=S', {params: {
pageNumber:params.page() - 1,
rangeStart:rangeStart,
rangeStop:rangeStop}})
.then(function(data, status) {
params.total(data.results.total);
$defer.resolve(data.results);
});
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<link rel="stylesheet"; href="https://unpkg.com/[email protected]/bundles/ng-table.min.css">
<script src="https://unpkg.com/[email protected]/bundles/ng-table.min.js"></script>
<body ng-app="clinang">
<div ng-controller="pacientesCtrl">
<a class='btn btnprimary' href='/getdadospac/?oper=S' >Button</a>
<table ng-table="vm.tableParams" class="table" show-filter="true">
<tr ng-repeat="paciente in $data">
<td title="'Pront'" filter="{ name: 'text'}" sortable="'pront'">
{{paciente.pront}}</td>
<td title="'Nome'" filter="{ age: 'number'}" sortable="'nome'">
{{paciente.nome}}</td>
</tr>
</table>
</div>
</body>
ng-app="clinang"onbody/htmltag