Hi.
I have been using meteor 1.6.1 on Mac.
The list of items is showing fine in my browser, but when I try to set the returned variable “selectedItem” after making click in a button. The content of the variable is not visible in the browser. (I can see the returned data with console.log(selectedItem);
//my method is inside: imports/components/items.js
myTask() {
this.selectedItem = new ReactiveVar('');
this.allTasks = Tasks.find({}, {
sort: {
createdAt: -1
}
});
selectedItem = this.allTasks.fetch()[0].text;
return selectedItem;
}
Fragment of HTML:
<ul>
<li ng-repeat="task in $ctrl.tasks" ng-class="{'checked': task.checked}">
<span class="text">
{{task.text}}
</span>
</li>
</ul>
<button class="random-btn" ng-click="$ctrl.myTask()">GetMyTask</button>
<label class="myselectedClass">Jebus!! {{ selectedItem }}</label>
Any suggestion?.
Thanks.