ionic 1 decorator example

JavaScript
angular.module("myAppName").decorator(                                            
        "$ionicActionSheet",                                                         
        function $ionicActionSheetDecorator( $delegate ) {                           
              var originalWarn = $delegate.show;                                     
              $delegate.show = function decoratedWarn(msg) {                         
                  alert("about to show");//do whatever you want here
                originalWarn.apply($delegate, arguments);                            
              };                                                                     
              return $delegate;                                                      
        }                                                                            
); 
Source

Also in JavaScript: