Looking for help updating a controller variable from a directive to then display the new value using ng-show. Take a look at my implementation below:
Controller:
self.menuVisible = false;
Directive:
icon.bind('click', function(){
scope.menuCtrl.menuVisible = true;
})
Please Note: The directive contains additional code lines not relevant to this question, which is why I opted to use a directive instead of passing a controller function with ng-click.
View:
<div class="menu-item" ng-show="menuCtrl.menuVisible"></div>
<div class="icon" my-directive></div>
Even though there is no visible change when clicking on the element, checking menuCtrl.menuVisible in devtools reveals that it has been updated to true after the action.
I'm seeking guidance on what could be improved in my approach. Any assistance would be greatly appreciated. Thank you!