2017-10-13 23 views
0

我有一個名爲「gimmick」的index.html裏面的javascript函數。我有打字稿功能。我的標準是從typescript函數內部調用javascript函數。有人請提出一些想法,以便我可以從typescript訪問javascript功能。如何從離子ts調用JavaScript函數?

回答

0

這是我要做的事:

  1. 的index.html文件

    <button id="callMyJSFunction" onclick="myJSFunction()" style="display:none;"></button> <script> function myJSFunction(){ alert('IN'); } </script> 
    
  2. TS文件:

    myTSFunction(){ var btn = document.getElementById('callMyJSFunction'); btn.onclick.apply(btn); }