【问题标题】:Angular Google map is not displayed when it is placed within sweetalert2 popupAngular Google 地图放置在 sweetalert2 弹出窗口中时不显示
【发布时间】:2019-11-16 13:41:06
【问题描述】:

我正在尝试使用 sweetalert2 显示一个 google 地图段是一个弹出区域。以下 sweetalert2 函数中提供的相同 HTML 代码段在粘贴到 HTML 页面本身时有效。但不在警报中。

export function showGoogleMap() {
    swal({
        title: 'HTML <small>125</small>!',
        html: '<div style="width: 100%; height:500px;"><agm-map style="height: 300px;" [latitude]="51.678418" [longitude]="7.809007">\n' +
        '<agm-marker [latitude]="51.678418" [longitude]="7.809007"></agm-marker></agm-map></div>',
        width: '800px'
    });
}

那里只会显示一个空白区域。检查下图,但不在警告框中。你可以看到地图在 HTML 中工作我在这里做错了什么?

【问题讨论】:

  • 您应该提供一个 Minimal, Reproducible Example 来证明该问题。不仅仅是您的代码和屏幕截图的一部分。您可以在问题中使用代码 sn-p 或创建一个完整的小提琴来演示问题。

标签: html angular google-maps google-maps-api-3 sweetalert2


【解决方案1】:

看起来这个库不支持 HTML 中的角度代码,因此您在警报中的地图根本没有被呈现。见Using sweetalert 2 with custom html and AngularJS

这可能是一个替代https://github.com/sweetalert2/ngx-sweetalert2

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 2017-08-13
    相关资源
    最近更新 更多