<input type='number'> is auto increm

2019-07-04 16:28发布

问题:

I think I have found a bug concerning the following binding: <input type='number'> when using a controller

html:

... {ctrl.i}} ...

dart:

... @NgController(...) class AController { int i = 5; } ...

When one modifies the input field, then there is an infinite loop (auto increment or auto decrement)

Note that this problem does not happen when using no-scope like in:

...
<input type="number" ng-model="i">
{{i}}
...

Is that a bug? Is there a way to use <input type='number'>?

回答1:

I tried it but couldn't get it to work with int but works fine with double class ACController { double i = 5.0; }.

type 'double' is not a subtype of type 'int' of 'value'.

EDIT
Same error in Angular '0.9.9' works only with double.



回答2:

There may have been a bug, but it appears to be fixed now.

I verified that this use cases work in AngularDart 0.9.10.