In controller, I'm running an interval and showing the variable value on the view counting up:
$scope.value = 0;
var $higherScope = $scope;
interval = $interval(function () {
$scope.value++;
}, 1000);
Now I'm opening a modal, where I also want to show this variable counting up:
$modal.open({
templateUrl: 'modal.html',
backdrop: true,
windowClass: 'modal',
controller: function ($scope, $modalInstance) {
$scope.value = $higherScope.value;
}
});
When I'm doing it like this, the variable is not shown synchronously to the original var in the upper $scope, but just the state of the variable when I opened the modal.
How can I achieve showing the same in the modal as in the upper controller, i.e. counting up live?