Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type="number" passes String as argument #4014

Closed
rightisleft opened this issue Sep 5, 2015 · 5 comments
Closed

type="number" passes String as argument #4014

rightisleft opened this issue Sep 5, 2015 · 5 comments

Comments

@rightisleft
Copy link

When setting the field of:

num bZip;

From:

        <div class="form-group">
            <label for="billing_zip">Zip</label>
            <input type="number" id="billing_zip" [(ng-model)]="dto.bZip" class="form-control" [required]="true"/>
        </div>

EXCEPTION: Error during evaluation of "ngModel"
ORIGINAL EXCEPTION: type 'String' is not a subtype of type 'num' of 'value'.
ORIGINAL STACKTRACE:

Using Angular Dart alpha 35

Fix: if i set the field to String bZip on the DTO object

name: 'tickets'
version: 0.0.1
description: A ticket commerce application
author: Jack Murphy jack@rightisleft.com
homepage: https://www.rightisleft.com
environment:
  sdk: '>=1.0.0 <2.0.0'
dependencies:
#Server Dependencies
  json_object: "1.0.19"
  mongo_dart: "0.1.46"
  connection_pool: "0.1.0+2"
  dartson: "0.2.4"
  guinness: "0.1.17"
  shelf: '>=0.6.2 <0.7.0'
  shelf_static: "0.2.2"
  shelf_route: "0.14.0"
#Client Dependencies
  bootjack: "0.6.5"
  browser: ">=0.10.0+2 <0.11.0"
  sass: "0.4.2"
  angular2: "2.0.0-alpha.35"
transformers:
- dartson
- sass
- angular2:
    entry_points:
        - web/main.dart
    reflection_entry_points:
        - web/main.dart
- $dart2js:
    minify: true
    commandLineOptions:
    - --dump-info
    - --show-package-warnings
    - --trust-type-annotations
    - --trust-primitives
@IAPark
Copy link
Contributor

IAPark commented Sep 11, 2015

I don't seem to get an error in TypeScript, but it doesn't convert for me which is what I expected it to do. Would there be interest in converting to an int/number in cases where the type equals number? Or is this added complication and should be handled by other means

@rightisleft
Copy link
Author

I would assume that if the type is number - then the value exposed to the model would also be a numeric value.

Dart throws an error as its a type mismatch - converting the variable type to String fixes the symptom, but it should not be String ....

@zakton5
Copy link

zakton5 commented Apr 6, 2016

I have the latest beta version and I am still seeing this issue. A input with type=number using ngModel is returning a string to the model instead of a number. Any progress on this?

@gamebox
Copy link

gamebox commented Apr 21, 2016

@RemnantArcher Do you have a small plunk to verify this is till true as of Beta 15? I noticed that the tests don't cover the ng-model use-case, though on the surface don't see a reason why it should fail there.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants