So i have a controller which hides/shows part of its template based on value, let's say its something like this:
<div ng-show="isSelected"></div>
...
$scope.isSelected = true;
...
Pretty standard stuff, huh ?
Now, i have a directive to which im passing this flag:
<my-directive select="isSelected"></mydirective>
And in this directive i have it bound like this:
...
// Angular 1.4 syntax here mind you
bindToController: {
select: '=',
}
...
So in the controller of my directive i change this flag at some point, and i'd like that to be propagated all the way to the parent controller UI which should change.
I checked manually in DevTools that value on the controller is changed by the directive - so thats good.
But i have no idea how to cause UI refresh. It feels like something should be in $watch() or $apply(), but i have no idea if and where should i put something like that.
Alternative solution i used to date was to pass function from controller to my directive which changes this value, after being called - that worked, but it feels like a bad design since it results in more or less same function had to be added each time i want to use directive :/
Any tips will be of course greatly appreciated.