Reputation: 909
When I want display value from URL with Observable I have just one letters.
I try to log value, when I take back I have full value
My component :
export class ArticlesComponent implements OnInit {
article$: Observable<string>;
constructor(private route: ActivatedRoute) {
}
ngOnInit() {
this.article$ = this.route.paramMap.pipe(
switchMap((params: ParamMap) => {
console.log(params.get('title'));
return params.get('title');
}
)
);
console.log(this.article$);
}
}
Output console.log : foobar
My HTML :
<div *ngIf="article$ | async">
{{article$ | async}}
</div>
Output : r
Upvotes: 0
Views: 40
Reputation: 222582
Try using alias as and remove async
<div *ngIf="article$ | async as article">
{{article}}
</div>
Upvotes: 1