2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
* @license
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
import {AbstractControlDirective} from './abstract_control_directive';
|
2016-08-29 17:49:42 -07:00
|
|
|
import {ControlContainer} from './control_container';
|
2016-06-08 16:38:52 -07:00
|
|
|
import {ControlValueAccessor} from './control_value_accessor';
|
2017-02-21 03:26:51 +03:00
|
|
|
import {AsyncValidator, AsyncValidatorFn, Validator, ValidatorFn} from './validators';
|
2016-06-08 15:36:24 -07:00
|
|
|
|
2016-08-10 15:55:18 -07:00
|
|
|
function unimplemented(): any {
|
2016-08-25 00:50:16 -07:00
|
|
|
throw new Error('unimplemented');
|
2016-08-10 15:55:18 -07:00
|
|
|
}
|
2016-06-08 16:38:52 -07:00
|
|
|
|
2016-06-08 15:36:24 -07:00
|
|
|
/**
|
|
|
|
* A base class that all control directive extend.
|
2018-04-05 10:58:12 +01:00
|
|
|
* It binds a `FormControl` object to a DOM element.
|
2016-06-08 15:36:24 -07:00
|
|
|
*
|
|
|
|
* Used internally by Angular forms.
|
|
|
|
*
|
2018-04-05 22:31:44 +01:00
|
|
|
*
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
|
|
|
export abstract class NgControl extends AbstractControlDirective {
|
2016-08-29 17:49:42 -07:00
|
|
|
/** @internal */
|
2017-04-17 11:13:30 -07:00
|
|
|
_parent: ControlContainer|null = null;
|
|
|
|
name: string|null = null;
|
|
|
|
valueAccessor: ControlValueAccessor|null = null;
|
2016-08-29 11:33:49 -07:00
|
|
|
/** @internal */
|
|
|
|
_rawValidators: Array<Validator|ValidatorFn> = [];
|
|
|
|
/** @internal */
|
2017-02-21 03:26:51 +03:00
|
|
|
_rawAsyncValidators: Array<AsyncValidator|AsyncValidatorFn> = [];
|
2016-06-08 15:36:24 -07:00
|
|
|
|
2017-04-17 11:13:30 -07:00
|
|
|
get validator(): ValidatorFn|null { return <ValidatorFn>unimplemented(); }
|
|
|
|
get asyncValidator(): AsyncValidatorFn|null { return <AsyncValidatorFn>unimplemented(); }
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
abstract viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|