【发布时间】:2018-04-11 18:38:13
【问题描述】:
在文件app-component.html上有一个按钮:
<button type="button" onclick="confirmChanges()">Save Changes</button>
此confirmChanges 调用位于我的index.html 文件中的javascript 函数:
<script>
function confirmChanges(){
var optionSelected = confirm('Are you sure?');
if(optionSelected == true){
alert('Changes were applied sucessfully!');
updateAddress();
} else{
alert('You discarded the changes!');
}
}
</script>
updateAddress() 函数在我的app-component.ts 文件中。我想知道如何在不获取Uncaught ReferenceError 的情况下从 javascript 函数调用打字稿函数。谢谢。
【问题讨论】:
-
为什么他的点击事件没有在打字稿中绑定和处理?
标签: javascript angular typescript referenceerror