J
J
Joseph Kopeikin2018-02-02 13:37:41
JavaScript
Joseph Kopeikin, 2018-02-02 13:37:41

How to make a new observable property in observable object?

I create an object:
@observable myData;
Then I receive data from the server and write the response to this variable:

this.myData = response.json(); // {"fruits":["apple","orange","pineapple","grusha","arbuz"]}

I create a function in which I need to manipulate the data and add a calculated object to myData: When this object changes, nothing happens. All objects that were originally created in myData when the response from the server was assigned react to any changes in them, and separately created objects do not generate any actions when they change. I want to understand why the observer does not see them?
myData.freshFruits = ['apple','orange'];

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question