File tree 1 file changed +9
-2
lines changed
nativescript-angular/value-accessors
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { ControlValueAccessor } from "@angular/forms" ;
2
+ import { View } from "tns-core-modules/ui/core/view" ;
2
3
3
- export class BaseValueAccessor < TView > implements ControlValueAccessor {
4
+ export class BaseValueAccessor < TView extends View > implements ControlValueAccessor {
4
5
private pendingChangeNotification : number = 0 ;
5
6
onChange = ( _ ) => { } ;
6
7
onTouched = ( ) => { } ;
@@ -19,7 +20,13 @@ export class BaseValueAccessor<TView> implements ControlValueAccessor {
19
20
} ;
20
21
}
21
22
22
- registerOnTouched ( fn : ( ) => void ) : void { this . onTouched = fn ; }
23
+ registerOnTouched ( fn : ( ) => void ) : void {
24
+ this . onTouched = fn ;
25
+ }
26
+
27
+ setDisabledState ( isDisabled : boolean ) : void {
28
+ this . view . isEnabled = ! isDisabled ;
29
+ }
23
30
24
31
writeValue ( _ : any ) { }
25
32
}
You can’t perform that action at this time.
0 commit comments