viewmodel
viewmodel copied to clipboard
false for attribute
When I have in the vm an attribute 'show' with default: true it should be true When I set it to false It should be false
this scenario does not pass to me... if I do: template.viewmodel.show(false) in an event the show attribute does not change! if I do it in the browser console (after logging the vm) it works.
is this a bug?
What do you mean you do it in an event? Show me the code.
On Nov 29, 2016 7:43 AM, "Frank Pimenta" [email protected] wrote:
When I have in the vm an attribute 'show' with default: true it should be true When I set it to false It should be false
this scenario does not pass to me... if I do: template.viewmodel.show(false) in an event the show attribute does not change! if I do it in the browser console (after logging the vm) it works.
is this a bug?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/280, or mute the thread https://github.com/notifications/unsubscribe-auth/AED31j5q2Elcjuu0WtS3oss8PS211ns1ks5rDDoWgaJpZM4K_DKN .
Template.file.viewmode({
hasFile: false,
autorun() {
this.hasFile(!!this.data().file); // here it sets to true
},
events: {
'click a.delete-file'(event, template) {
event.preventDefault();
Meteor.call('deletefile', this.data().file._id, (err, response) => {
if(response) {
this.hasFile(false); // it does not set hasFile to false
} else {
// alert
console.log(err);
}
});
}
}
}
Does it work without the autorun?
On Nov 29, 2016 8:05 AM, "Frank Pimenta" [email protected] wrote:
Template.file.viewmode({ hasFile: false, autorun() { this.hasFile(!!this.data().file); // here it sets to true }, events: { 'click a.delete-file'(event, template) { event.preventDefault();
Meteor.call('deletefile>', this.data().file._id, (err, response) => { if(response) { this.hasFile(false); // it does not set hasFile to false } else { // alert console.log(err); } }); }
} }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/280#issuecomment-263594567, or mute the thread https://github.com/notifications/unsubscribe-auth/AED31tcKbkEB8HNZW3cgngcwMmGD0OmDks5rDD9IgaJpZM4K_DKN .
Yes. Manuel. It works fine. After trying it I found out it was my issue. Thank you for the support :)