0

I have angular2 application, I want to use in it hlghtta from an external JS file myJSfile.js

var hlghtta = function (b, t, re, c) {
    "use strict";
     .......some functions here
};
module.exports = hlghtta;

however I cannot import it into my component with

import hlghtta from "hlghtta";

I already added myJSfile.js to .angular-cli.json could you please help guys? might be something simple.

1 Answer 1

1

Try this

Ideally you should have typings but if not you can use this way . You can also check this link on more info

declare var hlghtta: any;

import '../../../../hlghtta.js';
export class Component {
    ngOnInit() {
        new hlghtta(params);   
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.