use $intervalservice
Angular wrapper for window.setInterval here doc
$interval(function(){
vm.name = 'Jon';
}, 1000);
do not forget to enter $intervalhow,
.controller('ExampleController', ['$scope', $interval, function($scope, $interval) { ....
when using setIntervalit outside the angular scope, so you need to use it $intervalhere. $intervalruns against scope
OR use $scope.$apply()
window.setInterval(function(){
vm.name = 'Jon';
$scope.$apply();
}, 5000);
$apply