From b3ef1b46edfe83f10ed455d5520027f731563f32 Mon Sep 17 00:00:00 2001 From: Pasvaz Date: Wed, 12 Feb 2014 16:20:00 +0100 Subject: [PATCH] Handle Angular Promises. Fix #57 --- bindonce.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bindonce.js b/bindonce.js index d43abf1..0044280 100644 --- a/bindonce.js +++ b/bindonce.js @@ -211,7 +211,19 @@ var value = (attrs.bindonce) ? scope.$eval(attrs.bindonce) : true; if (value !== undefined) { - bindonceController.runBinders(); + // since Angular 1.2 promises are no longer + // undefined until they don't get resolved + if (value.then && typeof value.then === 'function') + { + value.then(function () + { + bindonceController.runBinders(); + }); + } + else + { + bindonceController.runBinders(); + } } else {