I am getting following error when try to import existing Vanilla JavaScript library to Angular 6 component. Please suggest how to fix it.
Syntax to import the library, I have written
import * as ExistingLibrary from 'app/main/libs/ExistingLibrary.js';
ExistingLibrary.doJob is not a function
External JavaScript library - ExistingLibrary.js
var ExistingLibrary = new (function () {
this.doJob = doJob;
function doJob(template, options) {
function f1(template, options) {}
function f2(template, options) {}
});
var ExistingLibrary = new (function () {
this.doJob = doJob;
function doJob(template, options) {
function f1(template, options) {}
function f2(template, options) {}
});
instead of this you need to export the functions like this:
export function doJob(template, options) { }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With