figo
figo

Reputation: 11

How to refresh label when using setInterval with ionic framework

I used setInteval to update my variable $scope.labelText on per second in controller.js, but the label binding this variable can not be refreshed synchronously. Is there a way to trigger a refresh?

Upvotes: 0

Views: 124

Answers (1)

Divyesh Savaliya
Divyesh Savaliya

Reputation: 2730

You can use $scope.apply as follow

$scope.$apply(function () {
     $scope.labelText = "new value";
});

Upvotes: 1

Related Questions