![](/img/trans.png)
[英]VS Code not indicating that method does not exist in Angular template
[英]VS Code - How to create a method from angular html template?
您可以使用擴展程序My Code Actions v0.6.0。
將其添加到您的settings.json
"my-code-actions.actions": {
"[html]": {
"Create function {{atCursor:$1}}": {
"file": "${fileBasenameNoExtension}.ts",
"atCursor": "\\(click\\)=\"([^\"]+)\\(\\)\"",
"text": "function {{atCursor:$1}}() {\n}\n\n"
}
}
}
如果需要,您可以添加更復雜(多個)的編輯
您可以查看擴展的文檔頁面,查看添加/修改導入語句的復雜編輯示例。
如果 Angular 模板文件不是 html,請調整languageID
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.