@@ -9,6 +9,7 @@ import { NavParams } from '../../navigation/nav-params';
99import { NavOptions } from '../../navigation/nav-util' ;
1010import { Platform } from '../../platform/platform' ;
1111import { ViewController } from '../../navigation/view-controller' ;
12+ import { AlertInputOptions , AlertOptions , AlertButton } from './alert-options' ;
1213
1314
1415/**
@@ -39,7 +40,7 @@ import { ViewController } from '../../navigation/view-controller';
3940
4041 '<template ngSwitchCase="checkbox">' +
4142 '<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">' +
4344 '<div class="alert-checkbox-icon"><div class="alert-checkbox-inner"></div></div>' +
4445 '<div class="alert-checkbox-label">' +
4546 '{{i.label}}' +
@@ -51,7 +52,7 @@ import { ViewController } from '../../navigation/view-controller';
5152 '<template ngSwitchDefault>' +
5253 '<div class="alert-input-group">' +
5354 '<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">' +
5556 '</div>' +
5657 '</div>' +
5758 '</template>' +
@@ -73,16 +74,7 @@ import { ViewController } from '../../navigation/view-controller';
7374export class AlertCmp {
7475 activeId : string ;
7576 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 ;
8678 enabled : boolean ;
8779 hdrId : string ;
8880 id : number ;
@@ -147,9 +139,9 @@ export class AlertCmp {
147139 } ) ;
148140
149141 data . inputs = data . inputs . map ( ( input , index ) => {
150- return {
142+ let r : AlertInputOptions = {
151143 type : input . type || 'text' ,
152- name : isPresent ( input . name ) ? input . name : index ,
144+ name : isPresent ( input . name ) ? input . name : index + '' ,
153145 placeholder : isPresent ( input . placeholder ) ? input . placeholder : '' ,
154146 value : isPresent ( input . value ) ? input . value : '' ,
155147 label : input . label ,
@@ -158,6 +150,7 @@ export class AlertCmp {
158150 id : isPresent ( input . id ) ? input . id : `alert-input-${ this . id } -${ index } ` ,
159151 handler : isPresent ( input . handler ) ? input . handler : null ,
160152 } ;
153+ return r ;
161154 } ) ;
162155
163156
@@ -291,7 +284,7 @@ export class AlertCmp {
291284
292285 bdClick ( ) {
293286 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' ) ;
295288 if ( cancelBtn ) {
296289 this . btnClick ( cancelBtn ) ;
297290
0 commit comments