@@ -96,18 +96,18 @@ export const SELECT_VALUE_ACCESSOR = new Provider(
96
96
* ### Alert Options
97
97
*
98
98
* Since `ion-select` is a wrapper to `Alert`, by default, it can be
99
- * passed options in the `alertOptions ` property. This can be used to
99
+ * passed options in the `selectOptions ` property. This can be used to
100
100
* pass a custom alert title, subtitle or message. See the {@link ../../alert/Alert Alert API docs}
101
101
* for more properties.
102
102
*
103
103
* ```html
104
- * <ion-select [alertOptions ]="alertOptions ">
104
+ * <ion-select [selectOptions ]="selectOptions ">
105
105
* ...
106
106
* </ion-select>
107
107
* ```
108
108
*
109
109
* ```ts
110
- * this.alertOptions = {
110
+ * this.selectOptions = {
111
111
* title: 'Pizza Toppings',
112
112
* subTitle: 'Select your toppings'
113
113
* };
@@ -169,10 +169,12 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
169
169
@Input ( ) placeholder : string ;
170
170
171
171
/**
172
- * @input {any} Any addition options that the alert interface can take.
173
- * See the [Alert API docs](../../alert/Alert) for the create options.
172
+ * @input {any} Any additional options that the `alert` or `action-sheet` interface can take.
173
+ * See the [Alert API docs](../../alert/AlertController/#create) and the
174
+ * [ActionSheetController API docs](../../action-sheet/ActionSheetController/#create) for the
175
+ * create options for each interface.
174
176
*/
175
- @Input ( ) alertOptions : any = { } ;
177
+ @Input ( ) selectOptions : any = { } ;
176
178
177
179
/**
178
180
* @input {string} The interface the select should use: `action-sheet` or `alert`. Default: `alert`.
@@ -240,21 +242,21 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
240
242
console . debug ( 'select, open alert' ) ;
241
243
242
244
// the user may have assigned some options specifically for the alert
243
- let alertOptions = merge ( { } , this . alertOptions ) ;
245
+ let selectOptions = merge ( { } , this . selectOptions ) ;
244
246
245
247
// make sure their buttons array is removed from the options
246
248
// and we create a new array for the alert's two buttons
247
- alertOptions . buttons = [ {
249
+ selectOptions . buttons = [ {
248
250
text : this . cancelText ,
249
251
role : 'cancel' ,
250
252
handler : ( ) => {
251
253
this . ionCancel . emit ( null ) ;
252
254
}
253
255
} ] ;
254
256
255
- // if the alertOptions didn't provide an title then use the label's text
256
- if ( ! alertOptions . title && this . _item ) {
257
- alertOptions . title = this . _item . getLabelText ( ) ;
257
+ // if the selectOptions didn't provide a title then use the label's text
258
+ if ( ! selectOptions . title && this . _item ) {
259
+ selectOptions . title = this . _item . getLabelText ( ) ;
258
260
}
259
261
260
262
let options = this . _options . toArray ( ) ;
@@ -270,7 +272,7 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
270
272
271
273
let overlay : any ;
272
274
if ( this . interface === 'action-sheet' ) {
273
- alertOptions . buttons = alertOptions . buttons . concat ( options . map ( input => {
275
+ selectOptions . buttons = selectOptions . buttons . concat ( options . map ( input => {
274
276
return {
275
277
role : ( input . selected ? 'selected' : '' ) ,
276
278
text : input . text ,
@@ -280,17 +282,21 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
280
282
}
281
283
} ;
282
284
} ) ) ;
283
- alertOptions . cssClass = 'select-action-sheet' ;
285
+ var selectCssClass = 'select-action-sheet' ;
284
286
285
- overlay = new ActionSheet ( this . _app , alertOptions ) ;
287
+ // If the user passed a cssClass for the select, add it
288
+ selectCssClass += selectOptions . cssClass ? ' ' + selectOptions . cssClass : '' ;
289
+
290
+ selectOptions . cssClass = selectCssClass ;
291
+ overlay = new ActionSheet ( this . _app , selectOptions ) ;
286
292
287
293
} else {
288
294
// default to use the alert interface
289
295
this . interface = 'alert' ;
290
296
291
- // user cannot provide inputs from alertOptions
297
+ // user cannot provide inputs from selectOptions
292
298
// alert inputs must be created by ionic from ion-options
293
- alertOptions . inputs = this . _options . map ( input => {
299
+ selectOptions . inputs = this . _options . map ( input => {
294
300
return {
295
301
type : ( this . _multi ? 'checkbox' : 'radio' ) ,
296
302
label : input . text ,
@@ -302,8 +308,8 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
302
308
303
309
var selectCssClass = 'select-alert' ;
304
310
305
- // create the alert instance from our built up alertOptions
306
- overlay = new Alert ( this . _app , alertOptions ) ;
311
+ // create the alert instance from our built up selectOptions
312
+ overlay = new Alert ( this . _app , selectOptions ) ;
307
313
308
314
if ( this . _multi ) {
309
315
// use checkboxes
@@ -314,7 +320,7 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
314
320
}
315
321
316
322
// If the user passed a cssClass for the select, add it
317
- selectCssClass += alertOptions . cssClass ? ' ' + alertOptions . cssClass : '' ;
323
+ selectCssClass += selectOptions . cssClass ? ' ' + selectOptions . cssClass : '' ;
318
324
overlay . setCssClass ( selectCssClass ) ;
319
325
320
326
overlay . addButton ( {
@@ -327,7 +333,7 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy
327
333
328
334
}
329
335
330
- overlay . present ( alertOptions ) ;
336
+ overlay . present ( selectOptions ) ;
331
337
332
338
this . _isOpen = true ;
333
339
overlay . onDidDismiss ( ( ) => {
0 commit comments