我正在开发一个角度为4的应用程序,我有一个javascript函数可以从我的组件中调用
外部javascript文件是链接文件
所以要调用javascript文件,我做了以下代码:
const body = <HTMLDivElement> document.body;
const script = document.createElement('script');
script.innerHTML = '';
script.src = 'https://sase.wde.de/dedesa/name.file.js';
script.async = true;
script.defer = true;
script.type = 'text/javascript';
body.appendChild(script);
它工作正常,然后我以这种方式调用函数
ngAfterViewInit() {
loadFoo();
}
export default function loadFoo(): void {
const lastname = "dedee";
const firstname = "dede";
const mail = "ede@dede.d";
const mdn = "55662";
const siteweb = "dede.html";
const token = "dededede";
const date = "2018-05-29 14:03:57";
const webPage = "dedesz";
startNAmeNoReg(lastname, firstname, mail, mdn, webPage, token, siteweb, date);
startNAmePush(lastname, firstname, mail, mdn, webPage, token, siteweb, date);
}
当我调用该函数时,它会给我错误
ERROR ReferenceError:未定义startNAmeNoReg