Actually, you don't need to use the viewModel
for the children at all.
All the child views in the component chain do have a natural access to the parent viewModel
.
Ext.define('APP.view.Main', {
extend: 'Ext.panel.Panel',
alias: 'widget.main',
viewModel: {
data: {
title: 'TITLE',
name: 'NAME'
}
},
bind: { title: '{title}' },
items: [{ xtype: 'child' }]
});
Ext.define('APP.view.Child', {
extend: 'Ext.container.Container',
alias: 'widget.child',
items: [{
xtype: 'label',
bind: { value: '{name}' }
}]
});
See the ExtJS guide for further explanation. (I sincerely recommend reading all of it :) ).
Hope this helps a little!