Need to call an external/vendor function from a component. In index.html the call looks like:
function doSomething(id) {
$.somethingSpace("doSomething",id);
}
Now I want to call $.somethingSpace("doSomething",id) from a component:
let $ = require('../../assets/jquery-3.1.1.min.js');
let something = require('../../assets/jquery.Something.js');
...
doSomething(id : string) : void {
$.somethingSpace("doSomething",id);
}
But get an error: $.somethingSpace is not a function. How to do it the right way? Thanks in advance for any help!
According to this article , you can use do this:
declare var $: any;
And you don't forget to inject jquery into index.html.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.