Open jacklynlee31 opened 8 years ago
Trello Board: https://trello.com/b/6b5BaV48/8-1-restaurant-menu
PR: https://github.com/jacklynlee31/8.1-restaurant-menu/pull/1
MockUp:
So it looks like you still are working on getting your orders to show up on the sidebar.
In your current-orders
service, try to make a function that accepts a menuItem
and then pushes the item to the existing orderedFood
array.
Note that the normal push
function on arrays doesn't fire observers and Ember won't recognize the change.
So you'll need to look at Ember.ArrayProxy@pushObject: http://emberjs.com/api/classes/Ember.ArrayProxy.html#method_pushObject
It works just like push, but it fires observable change events.
After you get items to add to the orderedItems
array, you'll need to check your sidebar template because I think some variable names got out of sync.
Once you have that, add a new orderTotal
computed property. You could use Ember.computed.sum to help with that. Note that if you use computed.sum
, you'll have to first use mapBy
just like you did to get the max in your catcode.
@rtablada This should be ready to go.
Getting Started
Menu
console.log
the static JSON for the menu itemsconsole.log
the food model when I click on its price buttonconsole.log
the order when I click on the foods priceOrder Sidebar
console.log
the order whenever an item is added to the ordersubtotal
computed property that shows the price of all of the added itemssubtotal
for your order in your Order Component templateBack of House
Hard Mode