File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ export class BaseInput<T> extends Ion implements CommonInput<T> {
38
38
_disabled : boolean = false ;
39
39
_debouncer : TimeoutDebouncer = new TimeoutDebouncer ( 0 ) ;
40
40
_init : boolean = false ;
41
+ _initModel : boolean = false ;
42
+
41
43
id : string ;
42
44
43
45
/**
@@ -122,8 +124,14 @@ export class BaseInput<T> extends Ion implements CommonInput<T> {
122
124
*/
123
125
writeValue ( val : any ) {
124
126
if ( this . _writeValue ( val ) ) {
125
- this . _fireIonChange ( ) ;
127
+ if ( this . _initModel ) {
128
+ this . _fireIonChange ( ) ;
129
+ } else if ( this . _init ) {
130
+ // ngModel fires the first time too late, we need to skip the first ngModel update
131
+ this . _initModel = true ;
132
+ }
126
133
}
134
+
127
135
}
128
136
129
137
/**
@@ -161,6 +169,7 @@ export class BaseInput<T> extends Ion implements CommonInput<T> {
161
169
this . _debouncer . debounce ( ( ) => {
162
170
assert ( NgZone . isInAngularZone ( ) , 'IonChange: should be zoned' ) ;
163
171
this . ionChange . emit ( this . _inputChangeEvent ( ) ) ;
172
+ this . _initModel = true ;
164
173
} ) ;
165
174
}
166
175
}
You can’t perform that action at this time.
0 commit comments