From 02d34a26aa2135350200fc1a8809d5a18ad8f274 Mon Sep 17 00:00:00 2001 From: Cam Wiegert Date: Thu, 7 Dec 2017 14:26:19 -0600 Subject: [PATCH] fix(select) fall back to label text for title --- packages/core/src/components/select/select.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/core/src/components/select/select.tsx b/packages/core/src/components/select/select.tsx index 0911448c9d..ae46616623 100644 --- a/packages/core/src/components/select/select.tsx +++ b/packages/core/src/components/select/select.tsx @@ -4,6 +4,7 @@ import { deepCopy, isCheckedProperty } from '../../utils/helpers'; import { ActionSheet } from '../action-sheet/action-sheet'; import { Alert } from '../alert/alert'; +import { Label } from '../label/label'; import { Popover } from '../popover/popover'; import { SelectOption } from '../select-option/select-option'; @@ -31,7 +32,7 @@ export class Select { texts: any = []; // TODO typing - item: any; + label: Label; options: SelectOption[] = []; overlay: ActionSheet | Alert | Popover; @@ -105,8 +106,8 @@ export class Select { componentDidLoad() { - // Get the parent item - this.item = this.el.closest('ion-item'); + // Get the nearest label + this.label = this.el.closest('ion-item').querySelector('ion-label'); this.setOptions(); } @@ -332,8 +333,8 @@ export class Select { }]; // if the selectOptions didn't provide a title then use the label's text - if (!selectOptions.title && this.item) { - selectOptions.title = this.item.getLabelText(); + if (!selectOptions.title && this.label) { + selectOptions.title = this.label.getText(); } // If the user passed in an invalid interface we need to reset it to alert