Angular 7中的多个Mat-icon注册表

时间:2019-05-08 10:41:38

标签: angular7

当我尝试多个图标时,我在<mat-icon>标签中首先给出的图标对于所有mat-icon标签都是重复的。

constructor(private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer) {

     this.matIconRegistry.addSvgIcon('downld', this.domSanitizer.bypassSecurityTrustResourceUrl('./assets/images/DownloadCloud.svg'));
     this.matIconRegistry.addSvgIcon('match', this.domSanitizer.bypassSecurityTrustResourceUrl('./assets/images/Match.svg'));
     this.matIconRegistry.addSvgIcon('openfile', this.domSanitizer.bypassSecurityTrustResourceUrl('./assets/images/OpenFile.svg'));
  }
<mat-icon svgIcon="match"></mat-icon>
<mat-icon svgIcon="openfile"></mat-icon>
<mat-icon svgIcon="downld"></mat-icon>

Output

0 个答案:

没有答案