var lineArray = new ReactiveArray();
lineArray.push('Test');
Template.line.helpers({
getLineArray: function() {
console.log("getting line value");
var self = this;
self.myArray = self.lineArray || [];
console.log("next step");
return self.myArray.map(function(){
console.log("getting index/value");
return {value: value, index: index};
});
}
});
Template.line.events({
'click .item': function (e, t) {
t.array.push(e.target.value);
},
'keydown input': function(e, t) {
if (event.keyCode == 13) {
console.log('you hit enter for ' +e.target.index);
event.stopPropagation();
return false;
}
}
});
var showLineArray = new ReactiveArray();
showLineArray.push('block');
<template name="line">
<div>in Line</div>
{{#each getLineArray}}
<div display="{{showLineArray[index]}}" contenteditable="true" class="item" data-value="{{index}}">{{value}}</div>
<div>in each</div>
{{/each}}
</template>
The map function is not getting executed and so the line template is not being inserted. What am i doing wrong?