Is there a better solution for monitoring hide and show expressions across all elements in my app?
I am aware that I can achieve this by wrapping the show directive with a function that simply returns the argument:
<div ng-show="catchShow(myShowExpr == 42)"></div>
However, I am looking for a more comprehensive approach to monitor all hide/show events on all inputs in my application.
One option could be to override the ngShow and ngHide directives, but this would require reevaluating the expression.
Another possibility is to directly modify the source code, which is relatively simple:
var ngShowDirective = ['$animator', function($animator) {
return function(scope, element, attr) {
var animate = $animator(scope, attr);
scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
var fn = toBoolean(value) ? 'show' : 'hide';
animate[fn](element);
//An additional step could be added:
element.trigger(fn);
});
};
}];
However, this approach may prevent the use of the Google CDN...
Are there any alternative methods that others can suggest for accomplishing this task?