@ -37,7 +37,7 @@ export class CheckboxControlValueAccessor implements ControlValueAccessor {
|
||||
cd.valueAccessor = this;
|
||||
}
|
||||
|
||||
writeValue(value) { setProperty(this.renderer, this.elementRef, "checked", value); }
|
||||
writeValue(value: any) { setProperty(this.renderer, this.elementRef, "checked", value); }
|
||||
|
||||
get ngClassUntouched(): boolean {
|
||||
return isPresent(this.cd.control) ? this.cd.control.untouched : false;
|
||||
@ -54,6 +54,6 @@ export class CheckboxControlValueAccessor implements ControlValueAccessor {
|
||||
return isPresent(this.cd.control) ? !this.cd.control.valid : false;
|
||||
}
|
||||
|
||||
registerOnChange(fn): void { this.onChange = fn; }
|
||||
registerOnTouched(fn): void { this.onTouched = fn; }
|
||||
registerOnChange(fn: (_) => {}): void { this.onChange = fn; }
|
||||
registerOnTouched(fn: () => {}): void { this.onTouched = fn; }
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export class DefaultValueAccessor implements ControlValueAccessor {
|
||||
cd.valueAccessor = this;
|
||||
}
|
||||
|
||||
writeValue(value) {
|
||||
writeValue(value: any) {
|
||||
// both this.value and setProperty are required at the moment
|
||||
// remove when a proper imperative API is provided
|
||||
var normalizedValue = isBlank(value) ? '' : value;
|
||||
@ -60,7 +60,7 @@ export class DefaultValueAccessor implements ControlValueAccessor {
|
||||
return isPresent(this.cd.control) ? !this.cd.control.valid : false;
|
||||
}
|
||||
|
||||
registerOnChange(fn): void { this.onChange = fn; }
|
||||
registerOnChange(fn: (_) => void): void { this.onChange = fn; }
|
||||
|
||||
registerOnTouched(fn): void { this.onTouched = fn; }
|
||||
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ export class NgFormControl extends NgControl {
|
||||
this.ngValidators = ngValidators;
|
||||
}
|
||||
|
||||
onChange(c) {
|
||||
onChange(c: StringMap<string, any>) {
|
||||
if (!this._added) {
|
||||
setUpControl(this.form, this);
|
||||
this.form.updateValidity();
|
||||
|
@ -49,7 +49,7 @@ export class NgModel extends NgControl {
|
||||
this.ngValidators = ngValidators;
|
||||
}
|
||||
|
||||
onChange(c) {
|
||||
onChange(c: StringMap<string, any>) {
|
||||
if (!this._added) {
|
||||
setUpControl(this._control, this);
|
||||
this._control.updateValidity();
|
||||
|
@ -49,7 +49,7 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
|
||||
this._updateValueWhenListOfOptionsChanges(query);
|
||||
}
|
||||
|
||||
writeValue(value) {
|
||||
writeValue(value: any) {
|
||||
this.value = value;
|
||||
setProperty(this.renderer, this.elementRef, "value", value);
|
||||
}
|
||||
@ -69,8 +69,8 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
|
||||
return isPresent(this.cd.control) ? !this.cd.control.valid : false;
|
||||
}
|
||||
|
||||
registerOnChange(fn): void { this.onChange = fn; }
|
||||
registerOnTouched(fn): void { this.onTouched = fn; }
|
||||
registerOnChange(fn: () => any): void { this.onChange = fn; }
|
||||
registerOnTouched(fn: () => any): void { this.onTouched = fn; }
|
||||
|
||||
private _updateValueWhenListOfOptionsChanges(query: QueryList<NgSelectOption>) {
|
||||
query.onChange(() => this.writeValue(this.value));
|
||||
|
@ -22,7 +22,7 @@ function _find(c: AbstractControl, path: List<string | number>| string) {
|
||||
if (!(path instanceof List)) {
|
||||
path = StringWrapper.split(<string>path, new RegExp("/"));
|
||||
}
|
||||
if (ListWrapper.isEmpty(path)) return null;
|
||||
if (path instanceof List && ListWrapper.isEmpty(path)) return null;
|
||||
|
||||
return ListWrapper.reduce(<List<string | number>>path, (v, name) => {
|
||||
if (v instanceof ControlGroup) {
|
||||
@ -85,7 +85,7 @@ export class AbstractControl {
|
||||
}
|
||||
}
|
||||
|
||||
setParent(parent) { this._parent = parent; }
|
||||
setParent(parent: ControlGroup | ControlArray) { this._parent = parent; }
|
||||
|
||||
updateValidity({onlySelf}: {onlySelf?: boolean} = {}): void {
|
||||
onlySelf = isPresent(onlySelf) ? onlySelf : false;
|
||||
|
Reference in New Issue
Block a user