I have a directive that is getting a value passed into it from it's parent controller.
<hack-chart-controls counttime="vm.countInMinutes"></hack-chart-controls>
In the directive there are some scope
values that are used to create a chart
scope.averageVbcCountPosition = { value: scope.counttime };
scope.averagePayPosition = { value: 12 };
scope.storeCountPosition = { value: 5 };
These values are used to pass to yet another child directive
<hack-annual-expenses-chart hack-employee-hourly-rate="averagePayPosition.value"
hack-vbc-average-count-time="vbcCountTime.value"
hack-average-count-time="averageCountPosition.value"
hack-stores="storeCountPosition.value"
hack-store-daily-balances="dailyBalancesCountPosition.value"
hack-years="savingsProjectionPosition.value">
As you can see one of them depends on the passed in variable. I'm using a scope.$watch
to watch when that variable changes
scope.$watch('counttime', function(value) {
scope.counttime = value;
});
It is successfully updating as helpful from this link, but the chart doesn't update.
I tried a scope.$apply()
and I get an error that a $digest() is already in progress
error. What am I missing? How can I get the directive to essentially re-render the chart?