javascript - 我们如何在 html 代码中调用 typescript 函数(不在同一个文件中)
问题描述
我正在尝试为 Grafana 做一个插件,所以我以时钟面板(由 Grafana 提供)为例。
所以我的问题是我试图从 html 文件 options.html 中的文件 clock_ctrl.ts 调用 TypeScript 函数。
我尝试了很多方法:
<form [ngFormModel]="companyForm" (submit)="namefunction()"> <button type="submit">Save</button> </form>
但它不起作用
<script src="../clock_ctrl.ts"></script> <body onload ="namefunction();"> </body> <button type="submit">Save</button>
但我得到了错误
获取http://localhost:3000/clock_ctrl.ts 404(未找到)
我找不到解决问题的方法。
解决方案
推荐阅读
- android - 如何消费旧货
- android - 能够将 3D 模型加载到 Mapbox Native Android 中吗?
- java - Java中使用char索引的数组访问
- vb.net - 显示所有已安装的程序
- queue - 创建流程以检查组成员是否与流程中的用户相似
- amazon-s3 - AWS Glue Crawler S3 包含/排除模式
- cryptography - 如何获取 OID 值的 OID 描述?
- google-bigquery - 从 Julian 转换为 gregorian Bigquery
- c# - 如何在 C# mvc 中将 3 个参数路由到控制器中?
- android - 在图标旁边设置 BottomNavigationView 标题