Reload / Refresh template

0

Hello, I'm loading my view with a timer, and every time the timer runs, it does not clear the screen, but adds the same items again. I've tried cache = false, window.reload, state.reload, state.go, but no results, my code:

lista = function () {
    $http.post(G.URL + 'pagina.jsp')
        .then(function (response) {
            $scope.totalItens = response.data.records.length;
            $scope.items = response.data.records;
            $scope.counter = 1;
        }, function (error) { $scope.items = "Não foi possível listar."; });
}
$interval(function () {
    $scope.counter += 1;
    if ($scope.counter > 59) {
        $scope.counter = 1;
        lista()
        //$ionicHistory.clearCache([$state.current.name]).then(function () { $state.reload(); });
    }
}, 1000);
$scope.$watch(function () { return $scope.d = { tempo: $scope.counter }; }, true);

Thank you in advance.

    
asked by anonymous 05.08.2016 / 00:41

0 answers