'Using factories AngularJS

I've defined a factory like this in my application.ts file and added a module 'CrossFrameUtils' to it. I wanted to use this factory in a controller file(code below) I am not able to load the InterruptCrossFrame correctly.

Code for Factory:

factory('InterruptCrossFrame', ['CrossFrame', (CrossFrame) => {
return {
    searchForLaborMove: () => {
        return CrossFrame.call({
            frame: $window,
            message: {
                method: 'heliosInterruptListener',
                data: {
                    action: 'search',
                    parameters: true,
                },
            },
        }).catch(errorResponse => {
                $log.error('Unable to search for interrupt notifications. Error: ', errorResponse)
            })
    },
}

}])

This is how I load this factory in the controller :

class Controller implements ng.IComponentController {
            static readonly $inject = [
                'InterruptCrossFrame',
            ]
            constructor(
                private readonly InterruptCrossFrame: any, // here
        
            ) {
            }
        
            $onInit(): void {
                this.activate()
            }
        
            activate(): void {
                console.log('Checking for Helios notifications on this page')
                this.InterruptCrossFrame.searchForLaborMove(); // and here
            }
        
            
        }

throws this.InterruptCrossFrame.searchForLaborMove is not a function. I'm trying to wrap my head around this and not able to find a solution



Sources

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

Source: Stack Overflow

Solution Source