mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge branch 'pr/7341'
# Conflicts: # src/components/select/test/single-value/index.ts # src/components/select/test/single-value/main.html
This commit is contained in:
@@ -119,7 +119,7 @@ export const SELECT_VALUE_ACCESSOR = new Provider(
|
||||
selector: 'ion-select',
|
||||
template: `
|
||||
<div *ngIf="!_text" class="select-placeholder select-text">{{placeholder}}</div>
|
||||
<div *ngIf="_text" class="select-text">{{_text}}</div>
|
||||
<div *ngIf="_text" class="select-text">{{selectedText || _text}}</div>
|
||||
<div class="select-icon">
|
||||
<div class="select-icon-inner"></div>
|
||||
</div>
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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<number>;
|
||||
notifications: string;
|
||||
status: string;
|
||||
gaming: string = '';
|
||||
os: string = 'win3.1';
|
||||
years: Array<number> = [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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,15 @@
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Currency</ion-label>
|
||||
<ion-select [(ngModel)]="currency" [selectedText]="selectedText()">
|
||||
<ion-option *ngFor="let cur of currencies" [value]="cur">
|
||||
{{cur.symbol}} ({{cur.code}}) {{cur.name}}
|
||||
</ion-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
|
||||
<button (click)="resetGender()">Reset Gender</button>
|
||||
|
||||
<p aria-hidden="true" padding>
|
||||
@@ -112,6 +121,8 @@
|
||||
<br>
|
||||
<code>status: {{status}}</code>
|
||||
<br>
|
||||
<code>currency: {{currency | json}}</code>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
</ion-content>
|
||||
|
||||
Reference in New Issue
Block a user