From 019209e79ce0752351f2b8d74511fa39694d1e93 Mon Sep 17 00:00:00 2001 From: James deBoer Date: Fri, 28 Mar 2014 14:00:01 -0700 Subject: [PATCH] fix(ng-model): Do not use valueAsNumber to work around dartbug.com/15788 Closes #694 For #801 --- lib/directive/ng_model.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/directive/ng_model.dart b/lib/directive/ng_model.dart index b220344aa..38d054500 100644 --- a/lib/directive/ng_model.dart +++ b/lib/directive/ng_model.dart @@ -381,7 +381,10 @@ class InputNumberLikeDirective { final NgModel ngModel; final Scope scope; - num get typedValue => inputElement.valueAsNumber; + + // We can't use inputElement.valueAsNumber due to http://dartbug.com/15788 + num get typedValue => num.parse(inputElement.value, (v) => double.NAN); + void set typedValue(num value) { // [chalin, 2014-02-16] This post // http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2010-January/024829.html @@ -391,7 +394,8 @@ class InputNumberLikeDirective { if (value == null) { inputElement.value = null; } else { - inputElement.valueAsNumber = value; + // We can't use inputElement.valueAsNumber due to http://dartbug.com/15788 + inputElement.value = "$value"; } }