I saw this tutorial coding a demo application with Angular.js. Its a demo version of Todo ( http://angularjs.org ), where it simply enters text into a text box, and then it is easily displayed on the page.
I wanted to recreate this feature in Meteor, and it does not work so well. Firstly, for some reason, he is not updating the last letter. Also the demo video made using Angular.js is much simpler and works better, is there a better way to do this in Meteor?
Also, if there is a way to access the DOM instead of a helper function? In the event function, I can use the variable 't' to access the DOM, but in the help function I am not sure, as, for example, if I wanted to grab the text from the div inside the helper function. I do not know how to do that.
Here is my Meteor code, and here is a live demo: http://todotestapp.meteor.com
Thanks in advance
HTML
<head> <title>Todo</title> </head> <body> {{> hello}} </body> <template name="hello"> <input id="personName" type="text"> <h1>Hello {{personName}}!</h1> </template>
Javascript Meteor
if (Meteor.isClient) { Template.hello.helpers({ personName: function () { return Session.get("personName"); } }); Template.hello.events({ 'keypress #personName': function (e, t) { Session.set("personName", t.find("#personName").value); } }); }
source share