Created
November 13, 2012 13:32
-
-
Save jpmx/4065778 to your computer and use it in GitHub Desktop.
Meteor preserve-inputs bug?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<title>bug-preserve-inputs</title> | |
</head> | |
<body> | |
{{> hello}} | |
</body> | |
<template name="hello"> | |
Radio Test: <input type="radio" name="myradio" {{isChecked}} /><br/><br/> | |
<button id="enableRadio">Enable Radio</button> | |
<button id="disableRadio">Disable Radio</button> | |
<pre> | |
Recreate: | |
+ Enable radio with button | |
+ Disable radio with button | |
= Reactivity stop working | |
</pre> | |
<hr/> | |
<a href="https://gist.github.com/4065778">Gist @ Github</a> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Meteor 0.5.0 | |
if (Meteor.isClient) { | |
Template.hello.events({ | |
'click #enableRadio' : function () { | |
console.log("radio: true"); | |
Session.set("radio", true); | |
}, | |
'click #disableRadio' : function () { | |
console.log("radio: false"); | |
Session.set("radio", false); | |
} | |
}); | |
Template.hello.isChecked = function() { | |
return Session.get("radio") ? ' checked' : ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just saw your question on IRC but you had gone. Not sure what is going on here. I also tried setting the Session variable from the browser console and it only works once. i.e.
Session.set("radio", true) -> Radio button is checked in webpage and source.
Session.set("radio", false) -> Radio button is unchecked in webpage and source.
Session.set("radio", true) -> Radio button is checked in source. No change in web page.
Very odd! It must be related to Reactive content but how I'm not sure.