Hi,
I found how to render a single vie with data from X models, although still an issue...
using:
can.view('todosAndUser', {todos: Todo.findAll(),user: User.findOne({id: 5})}).then(function(frag) {document.getElementById('todos').appendChild(fragment);});
works, although I need to parse data coming (on example from todos), because I need to check if the returned data object
has certain properties or not (it depends on each user, depending profile they have got properties or not)...
but didn't get the clue about that, if I add it like:
can.view('template-quick-info', {
todos: whatever.findAll({date: new Date().toRest() , quantity: '1D'}, function(data){
var o = {
sdjs: data[0].hasOwnProperty('xxx') ? data[0]['xxs'] : 'nxxxps',
disoijoid: data[0].hasOwnProperty('Distance') ? data[0]['Distance'] : 'noxxxance',
hwhatc: data[0].hasOwnProperty('Dxxxxion') ? data[0]['Dxxxn'] : 'nxxxxon'
};
return o;
}),
user: User.findOne({id: 5})
}).then(function(frag) {
document.getElementById('quick-info').appendChild(frag);
});
what I am getting on my template scope is the object straight from (data) and not my parsed and cleaned Object o
any light?
cheers in advance!