Fair enough. But if you use your original version we should cache the
parsed value rather than running parseFloat twice


On 17 July 2013 14:04, Simon Sparks <notifications@github.com> wrote:

> In src/ng/directive/input.js:
>
> > @@ -666,6 +663,13 @@ function checkboxInputType(scope, element, attr, ctrl) {
> >    });
> >  }
> >
> > +function typedValue(val, defaultVal) {
> > +  return isString(val)
> > +    ? !isNaN(parseFloat(val)) && isFinite(val)
> > +      ? parseFloat(val)
>
> Looking further, I noticed a suite of unit tests against various
> approaches:
> http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
> and saw that isFinite(String(n)) passes empty strings and whitespace as
> valid numbers.
> I'm guessing we could assume a use case where an empty string was
> desirable as a false value.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/angular/angular.js/pull/3251/files#r5241172>
> .
>