I have a javascript function named "gimmick" which is inside index.html. And I have a typescript function. My criteria is to call the javascript function from inside of the typescript function. Some one please suggest some idea so that I can access the javascript function from typescript.
1 Answer
This is how I do it:
in your index.html file :
<button id="callMyJSFunction" onclick="myJSFunction()" style="display:none;"></button> <script> function myJSFunction(){ alert('IN'); } </script>in your ts file:
myTSFunction(){ var btn = document.getElementById('callMyJSFunction'); btn.onclick.apply(btn); }