add route checking, not working yet...

This commit is contained in:
Rafael Schouten
2014-10-03 12:19:58 +10:00
parent 929839cb9f
commit 7313aecd19

View File

@@ -1,8 +1,10 @@
angular.module("admin.enterprises")
.controller "enterpriseCtrl", ($scope, Enterprise, PaymentMethods, ShippingMethods) ->
.controller "enterpriseCtrl", ($scope, $rootScope, Enterprise, PaymentMethods, ShippingMethods) ->
$scope.Enterprise = Enterprise.enterprise
$scope.PaymentMethods = PaymentMethods.paymentMethods
$scope.ShippingMethods = ShippingMethods.shippingMethods
$scope.$on "$routeChangeStart", (event, newUrl, oldUrl) ->
event.preventDefault()
for payment_method in $scope.PaymentMethods
payment_method.selected = payment_method.id in $scope.Enterprise.payment_method_ids
@@ -32,4 +34,4 @@ angular.module("admin.enterprises")
$scope.ShippingMethods.reduce (count, shipping_method) ->
count++ if shipping_method.selected
count
, 0
, 0