Ionic2 弹出窗口不工作且无错误

Ionic2 弹出窗口不工作且无错误,ionic2,Ionic2,Popup.alert无法使用“ionic framework:2.0.0-alpha.42” 我在本地和本地使用“离子框架:2.0.0-alpha.42”ionic@2.0.0-beta.15“全球NPM 以此为例 this.popup.alert({ title: "New Friend!", template: "Your friend, Obi wan Kenobi, just accepted your friend request!", cssClass: '

Popup.alert无法使用“ionic framework:2.0.0-alpha.42”

我在本地和本地使用“离子框架:2.0.0-alpha.42”ionic@2.0.0-beta.15“全球NPM

以此为例

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');
});
那个代码不起作用。我没有看到弹出窗口,也没有在控制台中显示“警报关闭”。我通过构造函数拉入“popup”

private popup: Popup;
constructor(popup: Popup) {
    this.popup = popup;
}

我解决了这个问题。您需要添加


到你的app.html。我在文档中没有看到这一点。

我不得不等几天才能将其标记为已回答。