Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
IvayloG opened this issue Sep 18, 2018 · 0 comments
Open

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

IvayloG opened this issue Sep 18, 2018 · 0 comments

Comments

@IvayloG
Copy link
Contributor

IvayloG commented Sep 18, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants