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.
n.render('listComponent', 'main_div', n.model.get('clients'))
Create a new model (automatic render on update model)
n.model.set('clients', { name : 'Eudald', age : 18, country : 'china' })
Add element in model (automatic render on update model)
n.model.push('clients', { name : 'Josep', age : 18, country : 'spain' })
Return array data from model(is array)
n.model.get('clients')
Pop element in model (automatic render on update model)
n.model.pop('clients')
Shift element in model (automatic render on update model)
n.model.shift('clients')
Reverse elements in model (automatic render on update model)
n.model.reverse('clients')
Count elements in model
n.model.size('clients')
n.model.length('clients')
Clear data in model (automatic render on update model)
n.model.clear('clients')
Delete element in model with index (automatic render on update model)
n.model.remove('clients' , 5)
Delete element in model with attributte (automatic render on update model)
n.model.remove('clients' , { name : 'josep' })
Delete model (automatic render on update model)
n.model.delete('clients')
Filter data in model for search systems(automatic render on update model) without destroy data in model
n.model.filter('clients', { age : 18, name : 'os' })
Automatic render on update models
n.render('listClients', 'main_div', n.model.get('clients'))
setTimeout(() => {
n.model.push('clients', { name : 'Simon' })
} ,5000);
Copy link