图像有时不会在 Angular2 中显示
Image sometimes does not show in Angular2
我有一张图片<img src="image.png">
。
当我使用this._router.navigate(['/Home']);
时,有时页面中的图像不会显示。相反,它显示如下:
我试过改成这样:
this._ngZone.run(() => {
this._router.navigate(['/Home']);
});
但是不行。什么可能导致这种情况?谢谢
<head>
<base href="/">
...
</head>
将其用作标题后的第一行。
之后根据/路径(html文件)的服务器路径使用图像路径。不要使用 HashStrategy!
我有一张图片<img src="image.png">
。
当我使用this._router.navigate(['/Home']);
时,有时页面中的图像不会显示。相反,它显示如下:
我试过改成这样:
this._ngZone.run(() => {
this._router.navigate(['/Home']);
});
但是不行。什么可能导致这种情况?谢谢
<head>
<base href="/">
...
</head>
将其用作标题后的第一行。
之后根据/路径(html文件)的服务器路径使用图像路径。不要使用 HashStrategy!