IgniteUI / igniteui-angular-wrappers

Ignite UI Angular component extensions by Infragistics

Home Page:http://igniteui.github.io/igniteui-angular-wrappers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Binding fails when setting null value and the old value persists.

IvayloG opened this issue · comments

Description

Binding fails when setting null value.

Steps to reproduce

Use the repository samples - igEditors sample http://localhost:3002/samples/igEditors/igEditors.html and add/update with the following code snippets:

  1. igEditorsTemplate.html
<tr>
	<td>igDatePicker</td>
	<td><input class="form-control" type="text" id="datePicker11" [(ngModel)]="editors.date" /></td>
	<td><ig-date-picker widgetId="datePicker1" [(ngModel)]="editors.date"  [options]="{width:'100%', revertIfNotValid:false, allowNullValue:true}"></ig-date-picker></td>
</tr>
<br/>
<button type="button" class="btn btn-default" (click)="setNullDate()">set Null Date</button>
<button type="button" class="btn btn-default" (click)="setNewDate()">set New Date</button>
<button type="button" class="btn btn-default" (click)="setEmptyString()">set Empty String</button>
  1. app.ts
	setNullDate(){
		this.editors.date = null;
	}

	setNewDate(){
		this.editors.date = new Date();
	}

	setEmptyString(){
		this.editors.date = "";
	}

Result

When setting allowNullValue:true: Once there is a valid date set, and setting the value to null the editor value is not set to null but the old one persists.

When setting allowNullValue:false and revertIfNotValid:false: Once there is a valid date set, and setting the value to null the editor value is not set to empty string but the old one persists..

Expected result

When setting allowNullValue:true , the editor value should become null.
When setting allowNullValue:false and revertIfNotValid:false, the editor value should become empty string.