File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ export class Select {
126
126
private _texts : Array < string > = [ ] ;
127
127
private _text : string = '' ;
128
128
private _fn : Function ;
129
+ private _isOpen : boolean = false ;
129
130
130
131
/**
131
132
* @private
@@ -185,14 +186,25 @@ export class Select {
185
186
}
186
187
}
187
188
188
- /**
189
- * @private
190
- */
191
189
@HostListener ( 'click' , [ '$event' ] )
192
190
private _click ( ev ) {
191
+ if ( ev . detail === 0 ) {
192
+ // do not continue if the click event came from a form submit
193
+ return ;
194
+ }
193
195
ev . preventDefault ( ) ;
194
196
ev . stopPropagation ( ) ;
197
+ this . _open ( ) ;
198
+ }
195
199
200
+ @HostListener ( 'keyup.space' , [ '$event' ] )
201
+ private _keyup ( ev ) {
202
+ if ( ! this . _isOpen ) {
203
+ this . _open ( ) ;
204
+ }
205
+ }
206
+
207
+ private _open ( ) {
196
208
if ( this . _disabled ) return ;
197
209
console . debug ( 'select, open alert' ) ;
198
210
@@ -245,6 +257,11 @@ export class Select {
245
257
} ) ;
246
258
247
259
this . _nav . present ( alert , alertOptions ) ;
260
+
261
+ this . _isOpen = true ;
262
+ alert . onDismiss ( ( ) => {
263
+ this . _isOpen = false ;
264
+ } ) ;
248
265
}
249
266
250
267
Original file line number Diff line number Diff line change 1
1
import { App , Page } from 'ionic-angular' ;
2
+ import { Control , ControlGroup } from 'angular2/common' ;
2
3
3
4
4
5
@Page ( {
@@ -9,6 +10,7 @@ class E2EPage {
9
10
carFeatures : Array < string > ;
10
11
pets : Array < string > ;
11
12
petOptions : Array < { text : string , value : string } > ;
13
+ authForm : ControlGroup ;
12
14
13
15
constructor ( ) {
14
16
this . toppings = [ 'bacon' , 'xcheese' ] ;
@@ -21,12 +23,21 @@ class E2EPage {
21
23
{ text : 'Honey Badger' , value : 'honeybadger' } ,
22
24
{ text : 'Pig' , value : 'pig' } ,
23
25
] ;
26
+
27
+ this . authForm = new ControlGroup ( {
28
+ name : new Control ( '' ) ,
29
+ select : new Control ( '' )
30
+ } ) ;
24
31
}
25
32
26
33
carChange ( selectedValues ) {
27
34
console . log ( 'carChange' , selectedValues ) ;
28
35
}
29
36
37
+ onSubmit ( data ) {
38
+ console . log ( 'onSubmit' , data ) ;
39
+ }
40
+
30
41
}
31
42
32
43
Original file line number Diff line number Diff line change 52
52
< code > pets: {{pets}}</ code > < br >
53
53
</ p >
54
54
55
+ < form [ngFormModel] ="authForm " (ngSubmit) ="onSubmit(authForm.value) ">
56
+ < ion-list padding-vertical >
57
+ < ion-item >
58
+ < ion-input ngControl ="name " type ="text "> </ ion-input >
59
+ </ ion-item >
60
+ < ion-item class ="no-border ">
61
+ < ion-label > Select</ ion-label >
62
+ < ion-select multiple ="true " ngControl ="select ">
63
+ < ion-option > 1</ ion-option >
64
+ < ion-option > 2</ ion-option >
65
+ < ion-option > 3</ ion-option >
66
+ </ ion-select >
67
+ </ ion-item >
68
+ < button full block class ="no-margin " type ="submit "> Submit</ button >
69
+ </ ion-list >
70
+ </ form >
71
+
55
72
</ ion-content >
You can’t perform that action at this time.
0 commit comments