Closed edin-m closed 7 years ago
I have simple component/controller/html for "file manager" so:
html:
<div> {{ ($ctrl.wickedSick || {}) | json }} </div>
component:
export default { restrict: 'E', bindings: {}, template, controller };
and controller:
class FileManagerController { constructor($scope) { this.wickedSick = 'wicked sick !!! 123'; setTimeout(() => { this.wickedSick = 'new value'; $scope.$apply(); }, 5000); } }
If I don't have $scope.$apply() I don't se resulting changes. And I would like not to use $apply() manually... Am I doing something wrong?
$scope.$apply()
$apply()
you should wrap all async functions to make them start digest cycle. In case of setTimeout angular provides you $timeout service which handles digest for you.
setTimeout
$timeout
I have simple component/controller/html for "file manager" so:
html:
component:
and controller:
If I don't have
$scope.$apply()
I don't se resulting changes. And I would like not to use$apply()
manually... Am I doing something wrong?