I'm starting to learn angular right now, and trying to understand the concept of an Observable and how to use them.
I've read all that there is about them in the angular documentation, but I'm either not understanding the concept correctly, or if just not possible.
I'll explain my idea:
I have an input element:
<div class="response" *ngFor="let reply of currentResponse.replies">
<input style="word-break: break-all;" type="text" placeholder="Message" value="{{ reply.text }}"/>
</div>
and in the component as a property:
fileData: ResponseModel[];
// and
currentResponse: ResponseModel
ResponseModel as context:
class ResponseModel {
constructor(
public id: string,
public replies: Array<Reply>,
public suggestedActions: [],
public inputHint: string
) {}
}
My idea:
could it be possible to attach the onchange event of the input to the fileData array or the currentResponse property, so that when a value changes in the input, the value will change in the array.
And then, when a value changes in the fileData array, update the service that is populating it.
Or If I've misunderstood the use of Observable.
Thanks, Nestor