Exetend a custom module

I have a module that Installed from an npm package and it’s working fine. But I need to change the behavior on one of my pages from the default settings and there is no option within the module to customize this particular item.

How do I go about extending this module so that I can change a function? It is imported in the app.component.ts file only as it is a module then there is a global reference to it. What I want to do is something like this:

import { coolWidget } from 'ionic2-widget'

    export class customWidget extends coolWidget.widget {
        
        function doSomething() {
           //change what this function...
       }
    }

Can I extend a module?

really don’t want to create a copy of the original module just to change one functions behavior

1 Like

Hi @zombiitv, as this question was some time ago and I am struggling with the same issue right now, did you find an answer to this?

See: https://coryrylan.com/blog/angular-component-inheritance-and-template-swapping

1 Like