Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4836

How to pass a reference into an element inside a {{#each}} loop

$
0
0

@pepper wrote:

Sorry, but I'm pretty new using Ember and I have this kind of dudu... check out this loop:

my view.hbs

  {{#each tweet as |model|}}
    <div>{{tweet.text}}</div>
    <button class="btn btn-default" {{action "reTweet"}} disabled={{isDone}}>Retweet</button>
    </div>
  {{/each}}

my controller.js: import Ember from 'ember';

export default Ember.Controller.extend({
  isDone: false,
  actions: {
    reTweet: function() {
      this.set('isDone', true);
    }
  }
});

And I would like to click some individual button and update the property of that individual element inside that loop. How could I do this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles