From 017cc524a4bdd6bf356b7e513e217bcac141a845 Mon Sep 17 00:00:00 2001 From: Robin Hu Date: Tue, 9 Jun 2015 10:35:07 -0400 Subject: [PATCH] Bindonce fails to handle cases where the bound data is 'null'. In every spot where 'value === undefined' is checked, also check to see if it is null. --- bindonce.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindonce.js b/bindonce.js index 8742d89..f2c1db5 100644 --- a/bindonce.js +++ b/bindonce.js @@ -100,7 +100,7 @@ var that = this; this.watcherRemover = $scope.$watch(bindonceValue, function (newValue) { - if (newValue === undefined) return; + if (newValue === null || typeof(newValue) === "undefined") return; that.removeWatcher(); that.checkBindonce(newValue); }, true); @@ -223,7 +223,7 @@ link: function (scope, elm, attrs, bindonceController) { var value = attrs.bindonce && scope.$eval(attrs.bindonce); - if (value !== undefined) + if (value !== null && typeof(value) !== "undefined") { bindonceController.checkBindonce(value); }