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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -