.html
<span *ngFor="let ydata of Data">
<!-- some html -->
<img fxFlex="85px" class="image" [src]="ydata.attachments[0].thumbnail_url | getImage>
</span>
.pipe.ts
import { Injectable, Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { HomeService } from '../services/home/home.service';
@Pipe({ name: 'getImage' })
export class GetImagePipe implements PipeTransform {
constructor(private _homeService: HomeService, private _sanitizer:DomSanitizer) {
}
transform(url: any): any {
// this return is working
// return '<somebase base64 string>'
this._homeService.getImg(url).subscribe(
res => {
return res._body;
},
error => {
return 'error';
}
);
}
}
not getting any response from pipe. I can see the service call on network and its getting base64 image string as response from service. But, in html its not updating always throwing as null.