n
n
nexo
Search…
Data Models
ALERT: Reactive is under construction > 0.0.44
You can relate models to a component if they are passed as data.
When a model receives a change, the rendering of related components automatically triggers.
1
n.render('listComponent', 'main_div', n.model.get('clients'))
Copied!
Create a new model (automatic render on update model)
1
n.model.set('clients', { name : 'Eudald', age : 18, country : 'china' })
Copied!
Add element in model (automatic render on update model)
1
n.model.push('clients', { name : 'Josep', age : 18, country : 'spain' })
Copied!
Return array data from model(is array)
1
n.model.get('clients')
Copied!
Pop element in model (automatic render on update model)
1
n.model.pop('clients')
Copied!
Shift element in model (automatic render on update model)
1
n.model.shift('clients')
Copied!
Reverse elements in model (automatic render on update model)
1
n.model.reverse('clients')
Copied!
Count elements in model
1
n.model.size('clients')
2
n.model.length('clients')
Copied!
Clear data in model (automatic render on update model)
1
n.model.clear('clients')
Copied!
Delete element in model with index (automatic render on update model)
1
n.model.remove('clients' , 5)
Copied!
Delete element in model with attributte (automatic render on update model)
1
n.model.remove('clients' , { name : 'josep' })
Copied!
Delete model (automatic render on update model)
1
n.model.delete('clients')
Copied!
Filter data in model for search systems(automatic render on update model) without destroy data in model
1
n.model.filter('clients', { age : 18, name : 'os' })
Copied!
Automatic render on update models
1
n.render('listClients', 'main_div', n.model.get('clients'))
2
3
setTimeout(() => {
4
n.model.push('clients', { name : 'Simon' })
5
} ,5000);
Copied!
Last modified 1yr ago
Copy link