Open rpapeters opened 9 years ago
This seems to be related to Angular 1.2. I have created a workaround with the help of http://blog.jdriven.com/2013/09/how-angularjs-directives-renders-model-value-and-parses-user-input/
angular.module('fg').directive('fgInputNumber', function() {
return {
require: 'ngModel',
link: function(scope, element, attr, ctrl) {
ctrl.$formatters.push(function(inputValue) {
if (typeof inputValue == 'number') {
ctrl.$setValidity('fgInputNumber', true);
return inputValue.toString();
}
if( angular.isNumber(inputValue) ){
ctrl.$setValidity('fgInputNumber', true);
}
return inputValue;
});
}
};
});
When initially loading a form with a Number field then the value of this field is not shown, while other fields do show their data. However after editing the field, the corresponding property is updated meaning the binding should be ok.