1// var that = this; // no need of this line
2this.messageSuccess = true;
3
4setTimeout(()=>{ //<<<---using ()=> syntax
5 this.messageSuccess = false;
6 }, 3000);
1function myClick() {
2 setTimeout(
3 function() {
4 document.getElementById('div1').style.display='none';
5 document.getElementById('div2').style.display='none';
6 }, 5000);
7}
1var myapp = angular.module("myapp", []);
2
3myapp.controller("DIController", function($scope, $timeout){
4
5 $scope.callAtTimeout = function() {
6 console.log("$scope.callAtTimeout - Timeout occurred");
7 }
8
9 $timeout( function(){ $scope.callAtTimeout(); }, 3000);
10});