Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
fix(ng-model): Do not use valueAsNumber to work around dartbug.com/15788
Browse files Browse the repository at this point in the history
Closes #694
For #801
  • Loading branch information
jbdeboer committed Mar 28, 2014
1 parent edf535a commit 019209e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/directive/ng_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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";
}
}

Expand Down

0 comments on commit 019209e

Please sign in to comment.