我想控制外部網站使用NW.js和webview,但任何時候我嘗試這個我有錯誤 - Angular沒有定義。NW.js - webview - Angular沒有定義錯誤
我來源:
的index.html
html...head...body...
<webview id="webview" name="webview" src="https://google.com/" allownw></webview>
<script src="../js/script.js"></script>
...body...html
的script.js
(function() {
var gui = require('nw.gui');
var win = gui.Window.get();
var webview = document.getElementById("webview");
var tray = new gui.Tray({
icon : 'assets/icon.png'
});
var menu = new gui.Menu();
menu.append(new gui.MenuItem({
type: 'normal',
label: '▶️ Play',
click: function() {
webview.executeScript({code:"var player=angular.element(document.body).injector().get('player'); player.play();"});
}
}));
tray.menu = menu;
}());
此代碼產生的錯誤我:的ReferenceError:角沒有定義
注意:網站google.com只是例子。