From 36513f443c2129d332f044b96c7c29985cc43301 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 29 Jan 2015 14:43:27 +0000 Subject: [PATCH] Ensure we are in a digest loop when updating validation errors --- services/web/public/coffee/main/new-subscription.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index a67e5fc034..6aefe3891f 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -81,7 +81,9 @@ define [ completeSubscription = (err, recurly_token_id) -> $scope.validation.errorFields = {} if err? - $scope.$apply () -> + # We may or may not be in a digest loop here depending on + # whether recurly could do validation locally, so do it async + $scope.$evalAsync () -> $scope.processing = false $scope.genericError = err.message _.each err.fields, (field)-> $scope.validation.errorFields[field] = true