弹出窗口不工作,没有错误
Popup not working and no errors
Popup.alert 无法使用 "ionic-framework: 2.0.0-alpha.42"。
我在本地使用 "ionic-framework: 2.0.0-alpha.42",在 NPM 中全局使用 "ionic@2.0.0-beta.15"。
以此document 为例。
this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert'
}).then(() => {
console.log('Alert closed');
});
该代码无效。我没有看到弹出窗口,也没有看到 "Alert closed" 在控制台中显示过。我通过构造函数拉入"popup"。
private popup: Popup;
constructor(popup: Popup) {
this.popup = popup;
}
我想通了这个问题。您需要添加
<ion-overlay></ion-overlay>
给你的app.html。我在文档中没有看到。
Popup.alert 无法使用 "ionic-framework: 2.0.0-alpha.42"。
我在本地使用 "ionic-framework: 2.0.0-alpha.42",在 NPM 中全局使用 "ionic@2.0.0-beta.15"。
以此document 为例。
this.popup.alert({
title: "New Friend!",
template: "Your friend, Obi wan Kenobi, just accepted your friend request!",
cssClass: 'my-alert'
}).then(() => {
console.log('Alert closed');
});
该代码无效。我没有看到弹出窗口,也没有看到 "Alert closed" 在控制台中显示过。我通过构造函数拉入"popup"。
private popup: Popup;
constructor(popup: Popup) {
this.popup = popup;
}
我想通了这个问题。您需要添加
<ion-overlay></ion-overlay>
给你的app.html。我在文档中没有看到。