File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
nativescript-angular/value-accessors Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 11import { ControlValueAccessor } from "@angular/forms" ;
2+ import { View } from "tns-core-modules/ui/core/view" ;
23
3- export class BaseValueAccessor < TView > implements ControlValueAccessor {
4+ export class BaseValueAccessor < TView extends View > implements ControlValueAccessor {
45 private pendingChangeNotification : number = 0 ;
56 onChange = ( _ ) => { } ;
67 onTouched = ( ) => { } ;
@@ -19,7 +20,13 @@ export class BaseValueAccessor<TView> implements ControlValueAccessor {
1920 } ;
2021 }
2122
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+ } ;
2330
2431 writeValue ( _ : any ) { }
2532}
You can’t perform that action at this time.
0 commit comments