i have problem with observable and async pipe. I have input in my component with Observable. In controller and on subscribe into observable in ngOnInit im get valid values. Problem is in template, I do not get valid values on template. I want to have async in image src attribute.
TvShowComponent (return Observable)
public getCoverLink(): Observable<string> {
return this.tvShowForm.get('cover').valueChanges.pipe(map((coverLink: string) => {
return coverLink;
}));
}
TvShowComponent template (using nested component)
<fp-cover-thumbnail [coverLink$]="getCoverLink()"></fp-cover-thumbnail>
CoverThumbnailComponent (with Input()) @Input() public coverLink$: Observable;
ngOnInit() {
this.coverLink$.subscribe(data => {
console.log(data); // works here
});
}
CoverThumbnailComponent template (but not works here :( )
<div class="cover-thumbnail-container">
<img #cover [src]="(coverLink$ | async)"> <!-- here not work -->
coverLink: {{ (coverLink$ | async) }} <!-- also here not work -->
</div>