Skip to content

Instantly share code, notes, and snippets.

@bhserna
Last active December 12, 2015 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhserna/4703481 to your computer and use it in GitHub Desktop.
Save bhserna/4703481 to your computer and use it in GitHub Desktop.
<script type="text/x-handlebars" data-template-name="tab">
<ul id="customer-tab">
{{#each tabItem in tabItems}}
<li>
<h3>
{{tabItem.food.name}}
<span><a href="#" {{action "removeFood" tabItem.food}}>x</a></span>
<span>${{money tabItem.total}}</span>
</h3>
</li>
{{else}}
<li><h3>Click a food to add it</h3></li>
{{/each}}
<li id="total"><h3>Total <span>${{money cents}}</span></h3></li>
</ul>
</script>
App.TabController = Ember.ObjectController.extend({
removeFood: function(food) {
var tabItems = this.get('tabItems'),
tabItem = tabItems.findProperty('food', food);
tabItems.removeObject(tabItem);
tabItem.deleteRecord();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment