@@ -9,6 +9,7 @@ import { NavParams } from '../../navigation/nav-params';
9
9
import { NavOptions } from '../../navigation/nav-util' ;
10
10
import { Platform } from '../../platform/platform' ;
11
11
import { ViewController } from '../../navigation/view-controller' ;
12
+ import { AlertInputOptions , AlertOptions , AlertButton } from './alert-options' ;
12
13
13
14
14
15
/**
@@ -39,7 +40,7 @@ import { ViewController } from '../../navigation/view-controller';
39
40
40
41
'<template ngSwitchCase="checkbox">' +
41
42
'<div class="alert-checkbox-group">' +
42
- '<button ion-button="alert-checkbox-button" *ngFor="let i of d.inputs" (click)="cbClick(i)" [attr.aria-checked]="i.checked" [disabled]="i.disabled" class="alert-tappable alert-checkbox" role="checkbox">' +
43
+ '<button ion-button="alert-checkbox-button" *ngFor="let i of d.inputs" (click)="cbClick(i)" [attr.aria-checked]="i.checked" [attr.id]="i.id" [ disabled]="i.disabled" class="alert-tappable alert-checkbox" role="checkbox">' +
43
44
'<div class="alert-checkbox-icon"><div class="alert-checkbox-inner"></div></div>' +
44
45
'<div class="alert-checkbox-label">' +
45
46
'{{i.label}}' +
@@ -51,7 +52,7 @@ import { ViewController } from '../../navigation/view-controller';
51
52
'<template ngSwitchDefault>' +
52
53
'<div class="alert-input-group">' +
53
54
'<div *ngFor="let i of d.inputs" class="alert-input-wrapper">' +
54
- '<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" class="alert-input">' +
55
+ '<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" [attr.id]="i.id" class="alert-input">' +
55
56
'</div>' +
56
57
'</div>' +
57
58
'</template>' +
@@ -73,16 +74,7 @@ import { ViewController } from '../../navigation/view-controller';
73
74
export class AlertCmp {
74
75
activeId : string ;
75
76
descId : string ;
76
- d : {
77
- cssClass ?: string ;
78
- message ?: string ;
79
- title ?: string ;
80
- subTitle ?: string ;
81
- mode ?: string ;
82
- buttons ?: any [ ] ;
83
- inputs ?: any [ ] ;
84
- enableBackdropDismiss ?: boolean ;
85
- } ;
77
+ d : AlertOptions ;
86
78
enabled : boolean ;
87
79
hdrId : string ;
88
80
id : number ;
@@ -147,9 +139,9 @@ export class AlertCmp {
147
139
} ) ;
148
140
149
141
data . inputs = data . inputs . map ( ( input , index ) => {
150
- return {
142
+ let r : AlertInputOptions = {
151
143
type : input . type || 'text' ,
152
- name : isPresent ( input . name ) ? input . name : index ,
144
+ name : isPresent ( input . name ) ? input . name : index + '' ,
153
145
placeholder : isPresent ( input . placeholder ) ? input . placeholder : '' ,
154
146
value : isPresent ( input . value ) ? input . value : '' ,
155
147
label : input . label ,
@@ -158,6 +150,7 @@ export class AlertCmp {
158
150
id : isPresent ( input . id ) ? input . id : `alert-input-${ this . id } -${ index } ` ,
159
151
handler : isPresent ( input . handler ) ? input . handler : null ,
160
152
} ;
153
+ return r ;
161
154
} ) ;
162
155
163
156
@@ -291,7 +284,7 @@ export class AlertCmp {
291
284
292
285
bdClick ( ) {
293
286
if ( this . enabled && this . d . enableBackdropDismiss ) {
294
- let cancelBtn = this . d . buttons . find ( b => b . role === 'cancel' ) ;
287
+ var cancelBtn = this . d . buttons . find ( b => ( < AlertButton > b ) . role === 'cancel' ) ;
295
288
if ( cancelBtn ) {
296
289
this . btnClick ( cancelBtn ) ;
297
290
0 commit comments