0

I have several text input that show the value in a collection, as:

<input type="text" id="myval" value={{myvalue}}>

I would like to have a Reset button that restore the original collection value, after the input text has benn edited. I tried with:

Router.render('mypage')

but it does not work.
I would like to solve this without adding a template helper for each input value.

Stefano Piovesan
  • 1,185
  • 3
  • 19
  • 37

2 Answers2

1

To render a template , that should be user Blaze.toHTML or Blaze.toHTMLWithData

For your case, you can use following code to re-render again:

$('#urformdiv').html(Blaze.toHTML(Template.mypage));
MoonFlyer
  • 91
  • 4
  • 1
    It works (see [example](http://meteorpad.com/pad/bscwJmetdm9LLY8fS/MyInput)). Unfortunately using iron-router, it loose the router data (and the `{{>yield}}` template render in a weird mode). – Stefano Piovesan Sep 27 '15 at 14:21
0

I found here the solution to restore the data using iron-router:

Router.current().render(Template.mypage).data();
Community
  • 1
  • 1
Stefano Piovesan
  • 1,185
  • 3
  • 19
  • 37