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';
|
2016-08-29 11:33:49 -07:00
|
|
|
import {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.
|
2016-08-17 07:44:39 -07:00
|
|
|
* It binds a {@link FormControl} object to a DOM element.
|
2016-06-08 15:36:24 -07:00
|
|
|
*
|
|
|
|
* Used internally by Angular forms.
|
|
|
|
*
|
2016-08-17 07:44:39 -07:00
|
|
|
* @stable
|
2016-06-08 15:36:24 -07:00
|
|
|
*/
|
|
|
|
export abstract class NgControl extends AbstractControlDirective {
|
2016-08-29 17:49:42 -07:00
|
|
|
/** @internal */
|
|
|
|
_parent: ControlContainer = null;
|
2016-06-08 15:36:24 -07:00
|
|
|
name: string = null;
|
|
|
|
valueAccessor: ControlValueAccessor = null;
|
2016-08-29 11:33:49 -07:00
|
|
|
/** @internal */
|
|
|
|
_rawValidators: Array<Validator|ValidatorFn> = [];
|
|
|
|
/** @internal */
|
|
|
|
_rawAsyncValidators: Array<Validator|ValidatorFn> = [];
|
2016-06-08 15:36:24 -07:00
|
|
|
|
|
|
|
get validator(): ValidatorFn { return <ValidatorFn>unimplemented(); }
|
|
|
|
get asyncValidator(): AsyncValidatorFn { return <AsyncValidatorFn>unimplemented(); }
|
|
|
|
|
|
|
|
abstract viewToModelUpdate(newValue: any): void;
|
|
|
|
}
|