diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 171d578c85..de2f4127c8 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -119,7 +119,7 @@ export const SELECT_VALUE_ACCESSOR = new Provider( selector: 'ion-select', template: `
{{placeholder}}
-
{{_text}}
+
{{selectedText || _text}}
@@ -180,6 +180,11 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy */ @Input() interface: string = ''; + /** + * @input {string} The text to display instead of the selected option's value. + */ + @Input() selectedText: string = ''; + /** * @output {any} Any expression you want to evaluate when the selection has changed. */ diff --git a/src/components/select/test/single-value/index.ts b/src/components/select/test/single-value/index.ts index 8f4f83e79b..8f6e8c97d5 100644 --- a/src/components/select/test/single-value/index.ts +++ b/src/components/select/test/single-value/index.ts @@ -1,38 +1,57 @@ import { Component } from '@angular/core'; import { ionicBootstrap } from '../../../../../src'; +export interface Currency { + symbol: string; + code: string; + name: string; +} @Component({ templateUrl: 'main.html' }) class E2EPage { - musicAlertOpts: any; + musicAlertOpts: any = { + title: '1994 Music', + subTitle: 'Select your favorite', + cssClass: 'music-select' + }; gender: string; - gaming: string; - os: string; - music: string; - month: string; - year: string; - years: Array; - notifications: string; - status: string; + gaming: string = ''; + os: string = 'win3.1'; + years: Array = [1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]; + music: string = null; + month: string = '12'; + year: string = '1994'; + notification: string = 'enable'; + status: string = "checked"; + + currencies: Currency[] = [ + { + symbol: '$', + code: 'USD', + name: 'US Dollar' + }, + { + symbol: '€', + code: 'EUR', + name: 'Euro' + }, + { + symbol: '£', + code: 'FKP', + name: 'Falkland Islands Pound' + }, + { + symbol: '¢', + code: 'GHS', + name: 'Ghana Cedi' + } + ]; + currency: Currency; constructor() { - this.gaming = ''; - this.os = 'win3.1'; - this.music = null; - this.month = '12'; - this.year = '1994'; - this.notifications = 'enable'; - this.gender = 'f'; - - this.years = [1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]; - - this.musicAlertOpts = { - title: '1994 Music', - subTitle: 'Select your favorite', - cssClass: 'music-select' - }; + this.currency = this.currencies[0]; } gamingCancel() { @@ -54,6 +73,10 @@ class E2EPage { resetGender() { this.gender = null; } + + selectedText() { + return this.currency.symbol; + } } diff --git a/src/components/select/test/single-value/main.html b/src/components/select/test/single-value/main.html index a773272c30..97d9163baf 100644 --- a/src/components/select/test/single-value/main.html +++ b/src/components/select/test/single-value/main.html @@ -95,6 +95,15 @@ + + Currency + + + {{cur.symbol}} ({{cur.code}}) {{cur.name}} + + + +