Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false for attribute #280

Open
frankapimenta opened this issue Nov 29, 2016 · 4 comments
Open

false for attribute #280

frankapimenta opened this issue Nov 29, 2016 · 4 comments

Comments

@frankapimenta
Copy link

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?

@ManuelDeLeon
Copy link
Owner

ManuelDeLeon commented Nov 29, 2016 via email

@frankapimenta
Copy link
Author

frankapimenta commented Nov 29, 2016

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);
         }
      });
    }
  }
}

@ManuelDeLeon
Copy link
Owner

ManuelDeLeon commented Nov 29, 2016 via email

@frankapimenta
Copy link
Author

Yes. Manuel. It works fine. After trying it I found out it was my issue. Thank you for the support :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants