如何在Angular2中投放图片?
我正在尝试在Angular2应用程序的图像src标签中的资产文件夹中放置我的图像之一的相对路径。我在组件中将变量设置为“ fullImagePath”,并在模板中使用了该变量。我尝试了许多不同的可能路径,但似乎无法提升自己的形象。Angular2中是否有一些总是与Django中的静态文件夹相关的特殊路径? 零件 import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-hero', templateUrl: './hero.component.html', styleUrls: ['./hero.component.css'] }) export class HeroComponent implements OnInit { fullImagePath: string; constructor() { this.fullImagePath = '../../assets/images/therealdealportfoliohero.jpg' } ngOnInit() { } } 我还将图片与该组件放置在相同的文件夹中,因此,由于模板和同一文件夹中的css在起作用,所以我不确定为什么图像的类似相对路径不起作用。这是与同一文件夹中的图像相同的组件。 import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-hero', templateUrl: './hero.component.html', styleUrls: …