[英]angular2 - image rendering not working
I have a strange problem in my application: 我的应用程序中有一个奇怪的问题:
The CSS and JS files included in index.html page are rendered properly . index.html页面中包含的CSS和JS文件已正确呈现 。
Instead the image are not loaded , I don't know why. 而是不加载图像 ,我不知道为什么。
Css/Js and Image are under the same folder distAdminLte2 that is so composed : Css / Js和Image在这样组成的同一文件夹distAdminLte2下:
├───css
│
├───img
│
└───js
this is how I reference the files in index.html file: 这是我在index.html文件中引用文件的方式:
<link rel="stylesheet" href="/assets/distAdminLte2/css/AdminLTE.min.css">
<script src="/assets/plugins/jQuery/jquery-2.2.3.min.js"></script>
<img src="/assets/distAdminLte2/img/icon-user.png">
This instead is a portion of the index.html file: it apply the css/js ( I can navigate throug them ) but it doesn't load the image: 相反,这是index.html文件的一部分:它应用css / js(我可以通过它们导航),但不会加载图像:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Reporting App</title>
<base href="/">
<link rel="stylesheet" href="/assets/distAdminLte2/css/AdminLTE.min.css">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<app-root>
<div class="wrapper">Loading...</div>
</app-root>
<script src="/assets/plugins/jQuery/jquery-2.2.3.min.js"></script>
<img src="/assets/distAdminLte2/img/icon-user.png"><br>
</body>
</html>
Notice that the <base href="/">
is set to '/' . 请注意,
<base href="/">
设置为'/'。
I need to let the image working also for a build. 我需要让图像也能正常工作。
Thanks to support 感谢支持
I solved this problem by changing the index.html of dist 我通过更改dist的index.html解决了这个问题
from 从
<base href="/">
to 至
<base href="">
Images now loads properly 图像现在可以正确加载
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.