Project

General

Profile

1
/**
2
 * @license
3
 * Copyright Google Inc. All Rights Reserved.
4
 *
5
 * Use of this source code is governed by an MIT-style license that can be
6
 * found in the LICENSE file at https://angular.io/license
7
 */
8
import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
9
import { FormControl } from '../../model';
10
import { ControlValueAccessor } from '../control_value_accessor';
11
import { NgControl } from '../ng_control';
12
import { AsyncValidator, AsyncValidatorFn, Validator, ValidatorFn } from '../validators';
13
export declare const formControlBinding: any;
14
/**
15
 * @whatItDoes Syncs a standalone {@link FormControl} instance to a form control element.
16
 *
17
 * In other words, this directive ensures that any values written to the {@link FormControl}
18
 * instance programmatically will be written to the DOM element (model -> view). Conversely,
19
 * any values written to the DOM element through user input will be reflected in the
20
 * {@link FormControl} instance (view -> model).
21
 *
22
 * @howToUse
23
 *
24
 * Use this directive if you'd like to create and manage a {@link FormControl} instance directly.
25
 * Simply create a {@link FormControl}, save it to your component class, and pass it into the
26
 * {@link FormControlDirective}.
27
 *
28
 * This directive is designed to be used as a standalone control.  Unlike {@link FormControlName},
29
 * it does not require that your {@link FormControl} instance be part of any parent
30
 * {@link FormGroup}, and it won't be registered to any {@link FormGroupDirective} that
31
 * exists above it.
32
 *
33
 * **Get the value**: the `value` property is always synced and available on the
34
 * {@link FormControl} instance. See a full list of available properties in
35
 * {@link AbstractControl}.
36
 *
37
 * **Set the value**: You can pass in an initial value when instantiating the {@link FormControl},
38
 * or you can set it programmatically later using {@link AbstractControl#setValue setValue} or
39
 * {@link AbstractControl#patchValue patchValue}.
40
 *
41
 * **Listen to value**: If you want to listen to changes in the value of the control, you can
42
 * subscribe to the {@link AbstractControl#valueChanges valueChanges} event.  You can also listen to
43
 * {@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
44
 * re-calculated.
45
 *
46
 * ### Example
47
 *
48
 * {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
49
 *
50
 * * **npm package**: `@angular/forms`
51
 *
52
 * * **NgModule**: `ReactiveFormsModule`
53
 *
54
 *  @stable
55
 */
56
export declare class FormControlDirective extends NgControl implements OnChanges {
57
    viewModel: any;
58
    form: FormControl;
59
    model: any;
60
    update: EventEmitter<{}>;
61
    isDisabled: boolean;
62
    constructor(validators: Array<Validator | ValidatorFn>, asyncValidators: Array<AsyncValidator | AsyncValidatorFn>, valueAccessors: ControlValueAccessor[]);
63
    ngOnChanges(changes: SimpleChanges): void;
64
    readonly path: string[];
65
    readonly validator: ValidatorFn | null;
66
    readonly asyncValidator: AsyncValidatorFn | null;
67
    readonly control: FormControl;
68
    viewToModelUpdate(newValue: any): void;
69
    private _isControlChanged(changes);
70
}
(1-1/4)