Providing function() from application to library

Discussão em 'Angular' iniciado por Lucas.Feichtinger, Maio 17, 2025.

  1. I have a class AppComponent in my application that has these functions:

    scan(){
    var success = function(result) {
    alert(JSON.stringify(result.text, undefined, 2));
    }
    var failure = function(result) {
    alert(JSON.stringify(result.text, undefined, 2));
    }
    cordova.plugins.BarcodeScanner.scan(success, failure, [])
    }


    My library provides the pages for my application, but I cannot add this function inside the library, because not every user of it needs the barcode scanner.

    My question: how can I dependency inject this function on a non-essential basis?

    Continue reading...

Compartilhe esta Página