Pulse7
9/8/2017 - 6:46 PM

$scope.$apply

div ng-controller="MainController"
  {{message}} //message binded to model, flow:model=>view
===============
(function () {
    let MainController = function ($scope) {
        $scope.message = "Hello world!";
        setTimeout(() => {
            $scope.message = "changed from timeout";
            $scope.$apply();
        }, 1500);
    }

    var app = angular.module("App", []);
    app.controller("MainController", MainController);
})();

============
alternative with $timeout
($scope,$timeout){
  $timeout(()=>$scope.message="changed from angular timeout",1500) //no $apply needed