kuskunko kuskunko - 3 months ago 10
AngularJS Question

zfloat directive for angular no work

I'm using breeze 1.5.0 and angular 1.3.0 rc1 I'm binding directly to a breeze entity to a property of type

decimal?
using the input in html table like this:

<table>
<thead>
<tr>
<th>Column1</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="i in vm.items">
<td ng-repeat="c in i.children">
<div>
<input ng-model="c.value" z-float />
</div>
</td>
</tr>
</tbody>




But comma and decimal point are ignored after entered a number [0-9]. For example I did'n enter the value "9.99".

I try this, but It didn't work. I did'n enter decimal values:

<input ng-model="vm.items[0].children[0].value" z-float />


I used "Angular Float Directive" more information here.

Answer

Nothing wrong with Breeze. They broke it in Angular.1.3.0. Now I have to find how and why.

FWIW, commas NEVER worked. JavaScript doesn't support ',' when parsing numeric strings and neither does it support internationalization of numbers (e.g., ',' for a decimal point).

Update 22 Sept 2014

Discovered they broke the signature of $formatters for v.1.3.0 and didn't tell anyone.See https://github.com/angular/angular.js/issues/9218

I have updated breeze.angular.directives to v.1.3.9 so it should now work with both versions.

See updated plunker: http://plnkr.co/edit/E2HgF7ASNWIdwsvzs5G0?p=preview which changed the zFloat model-value/element-value comparison from

return (value === +viewValue) ? viewValue : value;

to

return (+viewValue === +modelValue) ? viewValue : modelValue;