javascript - For-Each Loop in TextArea -


when tried use handlebars foreach-loop within plain html textarea, encountered me unexpected behaviour.

first let me show code:

my template.html:

<template name="test">   <textarea>     {{#each array}}       {{this}}     {{/each}}   </textarea> </template> 

my template.js:

template.test.array = function(){     return ["string1", "string2", "string3"]; } 

the problem:

i expected output looks that:

string1  string2  string3 

instead got this:

<!--data:46xrgsl9ax8aca3ek--> <!--data:tu6ficxrrasloh2w9--> <!--data:5h3pkyb66dhw4zrwf--> 

as workaround used handlebars helper , manipulated value of textarea utilizing jquery, worked perfectly.

still clarification case:

  1. why don't expected output? if use loop outside of textarea, prints strings properly.
  2. what these strings? javascript's internal object-ids or like?

every little appreciated!

these strings spark landmarks. weird, may fixed in rewrite of rendering engine in next meteor release.

this may related issue when string literal passed context helper; gets turned object.

https://github.com/meteor/meteor/issues/1447

one way go string literal write helper. instead of {{this}}, write {{printstring}}, , define

template.test.printstring = function() { return "" + this; } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -