textfield canvia las cadenas vacias a null

This commit is contained in:
Javi Gallego 2017-09-07 19:35:17 +02:00
parent 5570ec1c33
commit 207addf2c3
1 changed files with 5 additions and 1 deletions

View File

@ -25,6 +25,7 @@ export default class Textfield extends Component {
let div = this.element.firstChild;
componentHandler.upgradeElement(div);
}
link($scope, $attrs) {
let mdlTextField = this.element.firstChild.MaterialTextfield;
@ -32,9 +33,12 @@ export default class Textfield extends Component {
$scope.$watch($attrs.model,
() => mdlTextField.updateClasses_());
let $input = angular.element( this.input);
$input.controller('ng-model').$parsers.push(value => value === '' ? null : value);
}
onClearClick() {
this.input.value = '';
this.input.value = null;
this.checkValue();
let event = this.document.createEvent('HTMLEvents');