-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed
Labels
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When input[type="text"] ngModel convert model to string.
Expected behavior
If model is number or something else, it should be save its type
Minimal reproduction of the problem with instructions
Logic
class Foo {
public bar = {
foo: 42
}
onFocusOut(): void {
console.log (typeof bar.foo) //string
}
}
Template
<input type="text" [(ngModel)]="bar.foo" (blur)="onFocusOut()">
What is the motivation / use case for changing the behavior?
Backend returns value and Frontend need to do something with that, then update that one at Backend side. On condition if type of that value didn't change backend will update that one.
Ok i can convert that value at the logic side, but if i don't know about type changed. Or don't want to excess actions with type converting.
Environment
Angular version: 4.4.3
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX
- Platform:
Others:
jessycormier