2016-07-02 33 views
0

我已经试过类似的东西如何使用Angular材质添加图像?

  <img ng-src="~/Images/profile.svg" style="height:130px ; width:180px" class="md-card-image" alt="~/Frontend/images/question-circular-button.svg"> 

http://localhost/WebApp/~/Images/profile.svg无法加载资源:服务器与404状态(未找到)`

的图像是该文件夹中的反应。可有人请帮我?

+0

不要在你的url中使用〜,你为什么在这里使用ng-src? – Noppey

+0

@Noppey使用什么?我看到了一个这样的例子 –

+0

如果它位于/ webapp中的images目录中,只需使用“/images/profile.svg”即可。 〜是解决url的根源的剃刀/ asp.net thingy。 – Noppey

回答

0

如果您的源不是变量,请不要使用ng-src。只需使用常规的html src属性即可。

〜是解决root url服务器端的razor/asp.net thingy。它不会在html代码中工作。

只需使用“/Images/profile.svg”即可。

相关问题