Issue
I need help w my code, i want to refresh the scope of my list without refreshing the page, just the scope, i need to refresh it every 15 seconds, can somebody help me?
$scope.getAllTickets = function () {
$scope.listAllTickets = [];
$timeout(function () {
$.ajax({
url: '/Chamados/GetAllTickets',
type: 'POST',
success: function (result) {
$scope.listAllTickets = result;
$scope.$apply();
},
error: function (xhr, status) {
toastr.error("Ocorreu um erro ao carregar os dados.", "Tickets");
}
});
},
500);
}
Solution
So i figured it out how to do it, if someone needs a answer for a problem like mine, ill leave the code here
function refreshScope() {
timer = setTimeout(function () {
$scope.getAllTickets();
$scope.$apply();
}, 15000);
}
Answered By – Leonardo da Fonseca
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0