I'm currently working on a code that involves mapping through an array of strings using observables. My objective is to display the value from this array inside an input field. However, despite being able to view the array in the console, I encountered difficulties when attempting to assign it to the input field. The error message
Type 'Subscription' is missing the following properties from type 'Observable<any[]>': source, operator, lift, subscribe, and 3 more.
was also displayed. Instead of seeing the array element within the input field, all I could see was {{ slider$ | async }}
. What steps should I take to rectify this issue?
HTML:
<input type="input" value="{{ slider$ | async }}" />
TS:
const slides = ['Slide 1', 'Slide 2', 'Slide 3', 'Slide 4'];
let slider$: Observable<any[]>;
slider$ = of(slides).pipe(map((response) => {return response;})).subscribe(console.log);