-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Closed
Description
Ionic version: (check one with "x")
[ ] 1.x
[ X ] 2.x
I'm submitting a ... (check one with "x")
[ X ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Bind the text of ion-option when value attribute is null.
Expected behavior:
Should be able to set null.
Steps to reproduce:
Related code:
ts file:
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
@Component({
selector: 'page-ion-select-test',
templateUrl: 'ion-select-test.html'
})
export class IonSelectTestPage {
private ok: boolean = null;
constructor(public navCtrl: NavController, public navParams: NavParams) {}
send(): void {
console.log('===== SEND =====')
console.log(this.ok);
if (this.ok) {
console.log("ok!");
}
if (!this.ok) {
console.log("not ok!");
}
if (this.ok == null) {
console.log("Indeterminate");
}
}
}
html file:
<ion-header>
<ion-navbar>
<ion-title>Ion Select Test</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-list>
<ion-item>
<ion-label>Válido?</ion-label>
<ion-select [(ngModel)]="ok">
<ion-option [value]="null">Indeterminate</ion-option>
<ion-option [value]="true">Valid</ion-option>
<ion-option [value]="false">Invalid</ion-option>
</ion-select>
</ion-item>
</ion-list>
<button ion-button block (click)="send()">Send</button>
</ion-content>
Output:
Other information:
This functionality exists in Angular 2 since version 2.2.1 (see changelog).
Issues closed in Angular 2 to fix it and how they solved:
-
Issue #10349 => fix
-
Issue #12829 => fix
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Cordova CLI: 6.4.0
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
OS: Windows 10
Node Version: v6.3.0
rolandjitsu
Metadata
Metadata
Assignees
Labels
No labels
