简体   繁体   English

角度-组件之间共享图像

[英]Angular - sharing image between components

I am trying to show the 'app-title-icon' before the Title but the icon does not appear... 我正在尝试在标题前显示“ app-title-icon”,但该图标没有出现...

https://stackblitz.com/edit/angular-ndwttf https://stackblitz.com/edit/angular-ndwttf

<h1>
  <app-title-icon></app-title-icon>Title
</h1>

use correct image path 使用正确的图像路径

Stackblitz Stackblitz

.title-icon {
    content: url(https://images.pexels.com/photos/673865/pexels-photo-673865.jpeg?auto=compress&cs=tinysrgb&h=750&w=1260); 
    height: 20px;
    width: 20px;
}

代码没有错,图像URL有一些问题,也许它没有返回所需的图像,因为当我使用其他图像URL时,它可以正常工作。

If you see in console, you're being warned with message request-wrapper.js:229 Cross-Origin Read Blocking (CORB) blocked cross-origin response 如果您在控制台中看到此消息,则会request-wrapper.js:229 Cross-Origin Read Blocking (CORB) blocked cross-origin response消息request-wrapper.js:229 Cross-Origin Read Blocking (CORB) blocked cross-origin response警告request-wrapper.js:229 Cross-Origin Read Blocking (CORB) blocked cross-origin response

try another URL or local URL or exact image URL not site URL 尝试使用其他URL或本地URL或确切的图像URL,而不是站点URL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM