Skip to content

Instantly share code, notes, and snippets.

@t4t5
Created April 3, 2017 15:13
Show Gist options
  • Save t4t5/0a8105376fab0f449db119e9bbe6fd6a to your computer and use it in GitHub Desktop.
Save t4t5/0a8105376fab0f449db119e9bbe6fd6a to your computer and use it in GitHub Desktop.
todo-item-component
// src/ui/components/todo-item/component.ts
import Component from '@glimmer/component';
export default class TodoItem extends Component {
delete() {
let item = this.args.item;
this.args.deleteItem(item);
}
toggle() {
let item = this.args.item;
this.args.toggleItem(item);
}
};
@locks
Copy link

locks commented Apr 4, 2017

you could bypass this by doing either:

<todo-item
    @item={{item}}
    @deleteItem={{action deleteItem item}}
    @toggleItem={{action toggleItem item}}
    />

+

  <button onclick={{action @deleteItem}}>

or

  <button onclick={{action delete @item}}>

@t4t5
Copy link
Author

t4t5 commented Apr 4, 2017

@locks, oh! That's actually even nicer! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment