My AngularJS page displays a table with data coming from a JSON. What I want is for the table to be updated from time to time because the data is updated second by second and I display only the last 10.
<tr ng-repeat="linha in linhas">
<td ><abbr title="{{linha.descricao}}"> <a href=xxx.php?id_chamado={{linha.chamado}}>{{linha.chamado}}</a> </abbr> </td>
<td >{{linha.data}}</td>
<td >{{linha.nome}}</td>
<td >{{linha.acao}}</td>
<td >{{linha.cliente}}</td>
<td ><span class="label label-success">{{linha.sistema}}</span></td>
</tr>
Is there any simple way to reach this goal?
My controller, everything works perfectly in the load of the page. I just do not know how to invoke this function again inside the controller.
// JavaScript Document
var app = angular.module('sadApp', []);
app.controller('sadCtrl', function ($scope, $http) {
$http.get('http://192.168.0.14/a/historicochamadologlidosJson.php').
success(function(data, status, headers, config) {
$scope.linhas = data;
})
});
I've tried this code here:
angular.element(document.getElementById('MainWrap')).scope().$apply();
where MainWrap is the id of the div:
<div ng-controller="sadCtrl" id="MainWrap">