gpt4 book ai didi

javascript - 从 Angular Controller 调用 webview 方法

转载 作者:行者123 更新时间:2023-11-29 22:00:49 25 4
gpt4 key购买 nike

我在我的 angular Chrome 应用程序中集成了一个 webview ( https://developer.chrome.com/apps/tags/webview )。现在我想调用这个 webview 的 reload() 方法。在普通的 javascript 中,我只会通过 Id 获取 webview 并调用 reload() 方法:

var webview = document.getElementById('my-webview');
webview.reload();

但是我如何使用 angular 来执行此操作?

最佳答案

您可以像这样使用 document.querySelector 方法:

var webview = document.querySelector("my-webview");

但是 Angular 的方式应该是构建自定义指令来访问 DOM 对象。

另外不要忘记将 webview 包含到 manifest.json 权限中。

这是 Chrome Docs了解更多信息。

关于javascript - 从 Angular Controller 调用 webview 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23870960/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com