0
我有一個名爲「gimmick」的index.html裏面的javascript函數。我有打字稿功能。我的標準是從typescript函數內部調用javascript函數。有人請提出一些想法,以便我可以從typescript訪問javascript功能。如何從離子ts調用JavaScript函數?
我有一個名爲「gimmick」的index.html裏面的javascript函數。我有打字稿功能。我的標準是從typescript函數內部調用javascript函數。有人請提出一些想法,以便我可以從typescript訪問javascript功能。如何從離子ts調用JavaScript函數?
這是我要做的事:
:
<button id="callMyJSFunction" onclick="myJSFunction()" style="display:none;"></button> <script> function myJSFunction(){ alert('IN'); } </script>
在TS文件:
myTSFunction(){ var btn = document.getElementById('callMyJSFunction'); btn.onclick.apply(btn); }