In a few script I can find for instance
$timeout(function () {
$scope.my = 1;
});
instead of simply
$scope.my = 1;
What's the purpose to call $timeout without delay?
In a few script I can find for instance
$timeout(function () {
$scope.my = 1;
});
instead of simply
$scope.my = 1;
What's the purpose to call $timeout without delay?
This is a hack. :) But usually the intention is to wait until the end of the $digest
cycle and then set $scope.my
to 1
. Timeouts are called after all watches are done.
© 2022 - 2024 — McMap. All rights reserved.