I have a custom directive that I want some logic (in an if statement) to be run when a page loads or when its resized.
So for the the page load I have the if statement at the start of the custom directive then again duplicated in the on resize.
However to avoid this duplication is it possible to do something like the below?
angular.element($window).on('resize' || 'load', function () {
//my logic
}
Thanks.