问题
I have an image <img src="image.png">
.
When I use this._router.navigate(['/Home']);
, sometimes, the image in the page won't show. Instead it shows like this:
I tried to change to this:
this._ngZone.run(() => {
this._router.navigate(['/Home']);
});
But it does not work. What can potentially cause this? Thanks
回答1:
<head>
<base href="/">
...
</head>
Use that as the first line after head.
After that use the paths of image as per the server path of the / path(html file). Dont use HashStrategy!
来源:https://stackoverflow.com/questions/35979443/image-sometimes-does-not-show-in-angular2