Fixing the scope issue

This commit is contained in:
Will Marshall
2014-04-11 17:49:51 +10:00
parent 2e0485c064
commit 2d9be9ea06
2 changed files with 7 additions and 2 deletions

View File

@@ -1,6 +1,12 @@
Darkswarm.controller "CheckoutCtrl", ($scope, Order, storage, CheckoutFormState) ->
# We put Order.order into the scope for convenience
# However, storage.bind replaces Order.order
# So we must put Order.order into the scope AFTER it's bound to localStorage
$scope.Order = Order
storage.bind $scope, "Order.order", {storeName: "order_#{Order.order.id}"}
$scope.order = Order.order
$scope.CheckoutFormState = CheckoutFormState
#$scope.order = Order.order
$scope.accordion = {}
@@ -15,7 +21,6 @@ Darkswarm.controller "CheckoutCtrl", ($scope, Order, storage, CheckoutFormState)
storage.bind $scope, "accordion.payment"
storage.bind $scope, "CheckoutFormState.ship_address_same_as_billing", { defaultValue: true}
storage.bind $scope, "order", {storeName: "order_#{$scope.order.id}"}
$scope.purchase = (event)->
event.preventDefault()

View File

@@ -8,7 +8,7 @@
angular.module('Darkswarm').value('order', #{render "shop/checkout/order"})
-#%pre
-#{{ order | json }}
-#{{ Order.order == order }}
.large-12.columns
= render partial: "shop/checkout/details", locals: {f: f}