将Angular Google地图放置在sweetalert2弹出窗口中时不会显示

时间:2019-07-06 04:29:20

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

我正在尝试使用sweetalert2将Google地图段显示为弹出区域。当将其粘贴到HTML页面本身中时,下面sweetalert2函数中提供的相同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'
    });
}

那里只会显示一个空白区域。检查下图,但不在警告框中。您可能会看到Map正在HTML中运行。我在这里做错什么了?

enter image description here

1 个答案:

答案 0 :(得分:0)

该库似乎不支持HTML中的角度代码,因此警报中的地图完全无法渲染。参见Using sweetalert 2 with custom html and AngularJS

这可能是另一种https://github.com/sweetalert2/ngx-sweetalert2

希望这会有所帮助!