'AngularJS decorating a factory function not working

I'm trying to decorate uiGrid's GridRenderContainer factory in order to override the getVerticalScrollLength function. The reason is to try and fix the scroll issue when making row heights dynamic.

The issue I'm experiencing is that is does not appear to have the desired effect as the console.log is not getting fired.

Is there perhaps something that I am missing?

   app.config(["$provide", ($provide: any) => {
    $provide.decorator("GridRenderContainer", ["$delegate", ($delegate: any) => {
      $delegate.getVerticalScrollLength = function getVerticalScrollLength() {
        console.log("current scroll length -> " + Math.abs(this.getCanvasHeight() - this.getViewportHeight()) + this.grid.scrollbarHeight);
        return Math.abs(this.getCanvasHeight() - this.getViewportHeight()) + this.grid.scrollbarHeight !== 0 ? Math.abs(this.getCanvasHeight() - this.getViewportHeight()) + this.grid.scrollbarHeight : -1;
      };
      return $delegate;
    }]);
  }]);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source