[英]Dynamic data binding not working Angular Chrome Extension
作为Chrome扩展程序运行时,数据未绑定到Angular 6上。 下面是我的代码:
app.component.ts
constructor(){
chrome.tabs.query({
currentWindow: true,
active: true
}, function(tabs) {
console.log(tabs[0]);
if (tabs.length > 0) {
if (tabs[0].url !== undefined && tabs[0].url !== null && tabs[0].url !== '') {
this.tabId = tabs[0].id;
this.tabURL = tabs[0].url;
console.log("url1"+this.tabURL);
this.tabTitle = tabs[0].title;
this.favIconUrl = tabs[0].favIconUrl;
}
}
});
}
app.component.html
<p>Running on {{tabURL}}</p>
我们获取的数据对象和行已执行,但数据绑定未反映在UI上
后来我注意到,当我触发其他一些按钮单击事件时,UI会更新
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.