How do I handle an observable with the async pipe in a textbox value for Angular 6?

J-man

I have an observable that returns a custom object - I want to use the async pipe to get a property out of the object in the observable. When I use the following syntax, the <input /> value is just [object Object]?.color

<input type="text" value="{{myObservable$ | async}}?.color"></input>
malbarmavi

You can solve this by

Property binding

<input type="text" [value]="(myObservable$ | async)?.color"></input>

Template expression

<input type="text" value="{{*myObservable$ | async).?.color}}"></input>

in your question ?.color was not part of the template expression

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I return the response from an Observable/http/async call in angular?

Angular2 how to handle value of date pipe is null

Observable with Async Pipe in template is not working for single value

How to async pipe an observable in Angular

Angular how do I filter the data from an observable using rxjs pipe

How do I return the Resolved Data with the new RXJS 6 pipe/map in Angular 6?

How do I get the value in ng-template(Angular 6)?

*ngIf async pipe angular merge with another observable

Angular/RxJS How do I use observable pipe to generate ajax call hierarchy but return a single response?

How to pipe / map an Observable in Angular

Transform pipe in Angular 6 with Observable or Promise

How to return value as an observable in angular 6

How to handle boolean observables with the async pipe in Angular

How do I change the value of a textbox with this JQuery?

The Async pipe doesn't receive a value until I subscribe to the observable

how do i pass a hash into input checkbox value in angular 6

Use async pipe just to handle observable

need help on angular 7 Observable async pipe

Angular template binding with Observable async pipe issue

Does async pipe automatically unsubscribe from observable, if I change the observable?

How do I persist a value across RxJS 6 pipe operators?

Angular2 async pipe with observable

Using Angular, RxJs 6 and InMemoryAPI how do I get a returned Observable value that seems to be nested in multiple observable sources?

How to handle `ngIf` with async pipe values?

Using Angular Async Pipe to Subscribe to Observable

How do I use async pipe instead of using subscribe?

How do I assign a var value to a textbox?

Angular Async Pipe - Array in Object in Observable

How to update existing Observable in async pipe