Skip to content

Commit 01f3158

Browse files
committed
#5490 Nested Inline Models explanation text
1 parent 1d25935 commit 01f3158

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

resources/data/deck/learnneo/pages/GuideViewModels.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,19 @@ class MainView extends Container {
137137
}
138138
Neo.setupClass(MainView);
139139
</pre>
140+
141+
The output of this demo is supposed to exactly look the same like the previous demo.
142+
143+
This time we nest our Labels into a Container with a fit layout.
144+
Just for demo purposes, we want to avoid overnesting inside real apps.
145+
146+
Our top level VM now only contains the `hello` data prop, and we added a second VM inside the nested Container
147+
which contains the `world` data prop.
148+
149+
As a result, the bindings for all 3 Labels contain a combination of data props which live inside different VMs.
150+
As long as these VMs are inside the parent hierarchy this works fine.
151+
152+
The same goes for the Button handlers: `setData()` will find the closest matching data prop inside the VM parent chain.
153+
154+
We can even change data props which live inside different VMs at once. As easy as this:</br>
155+
`setData({hello: 'foo', world: 'bar'})`

0 commit comments

Comments
 (0)