Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
It is better to specify the type not through the primitive constructor, but through the string type (the one from TypeScript, with a small letter).
You are not using RxJS features. This piece of code can be done differently:
ngOnInit() {
this.Preview.url
.subscribe(new_url => this.url = new_url);
}
public previewUrl$: Observable<string>
ngOnInit() {
this.previewUrl$ = this.Preview.url
}
<div class="preview" *ngIf="(previewUrl$ | async) as url">
<img class="preview__img" [src]="url">
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question