Socket
Socket
Sign inDemoInstall

@angular/forms

Package Overview
Dependencies
Maintainers
1
Versions
831
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/forms - npm Package Compare versions

Comparing version 2.0.0-rc.6 to 2.0.0-rc.7

6

package.json
{
"name": "@angular/forms",
"version": "2.0.0-rc.6",
"version": "2.0.0-rc.7",
"description": "Angular 2 forms",

@@ -11,4 +11,4 @@ "main": "bundles/forms.umd.js",

"peerDependencies": {
"@angular/core": "^2.0.0-rc.6",
"@angular/common": "^2.0.0-rc.6"
"@angular/core": "^2.0.0-rc.7",
"@angular/common": "^2.0.0-rc.7"
},

@@ -15,0 +15,0 @@ "repository": {

@@ -10,58 +10,29 @@ import { EventEmitter } from '../facade/async';

/**
* If `NgForm` is bound in a component, `<form>` elements in that component will be
* upgraded to use the Angular form system.
* @whatItDoes Creates a top-level {@link FormGroup} instance and binds it to a form
* to track aggregate form value and validation status.
*
* ### Typical Use
* @howToUse
*
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link Component} annotation
* to use `NgForm` and its associated controls.
* As soon as you import the `FormsModule`, this directive becomes active by default on
* all `<form>` tags. You don't need to add a special selector.
*
* ### Structure
* You can export the directive into a local template variable using `ngForm` as the key
* (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
* {@link FormGroup} instance are duplicated on the directive itself, so a reference to it
* will give you access to the aggregate value and validity status of the form, as well as
* user interaction properties like `dirty` and `touched`.
*
* An Angular form is a collection of `FormControl`s in some hierarchy.
* `FormControl`s can be at the top level or can be organized in `FormGroup`s
* or `FormArray`s. This hierarchy is reflected in the form's `value`, a
* JSON object that mirrors the form structure.
* To register child controls with the form, you'll want to use {@link NgModel} with a
* `name` attribute. You can also use {@link NgModelGroup} if you'd like to create
* sub-groups within the form.
*
* ### Submission
* You can listen to the directive's `ngSubmit` event to be notified when the user has
* triggered a form submission.
*
* The `ngSubmit` event signals when the user triggers a form submission.
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <p>Submit the form to see the data object Angular builds</p>
* <h2>NgForm demo</h2>
* <form #f="ngForm" (ngSubmit)="onSubmit(f.value)">
* <h3>Control group: credentials</h3>
* <div ngModelGroup="credentials">
* <p>Login: <input type="text" name="login" ngModel></p>
* <p>Password: <input type="password" name="password" ngModel></p>
* </div>
* <h3>Control group: person</h3>
* <div ngModelGroup="person">
* <p>First name: <input type="text" name="firstName" ngModel></p>
* <p>Last name: <input type="text" name="lastName" ngModel></p>
* </div>
* <button type="submit">Submit Form</button>
* <p>Form data submitted:</p>
* </form>
* <pre>{{data}}</pre>
* </div>
* `,
* directives: []
* })
* export class App {
* constructor() {}
* * **npm package**: `@angular/forms`
*
* data: string;
* * **NgModule**: `FormsModule`
*
* onSubmit(data) {
* this.data = JSON.stringify(data, null, 2);
* }
* }
* ```
*
* @stable

@@ -68,0 +39,0 @@ */

@@ -27,58 +27,29 @@ /**

/**
* If `NgForm` is bound in a component, `<form>` elements in that component will be
* upgraded to use the Angular form system.
* @whatItDoes Creates a top-level {@link FormGroup} instance and binds it to a form
* to track aggregate form value and validation status.
*
* ### Typical Use
* @howToUse
*
* Include `FORM_DIRECTIVES` in the `directives` section of a {@link Component} annotation
* to use `NgForm` and its associated controls.
* As soon as you import the `FormsModule`, this directive becomes active by default on
* all `<form>` tags. You don't need to add a special selector.
*
* ### Structure
* You can export the directive into a local template variable using `ngForm` as the key
* (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
* {@link FormGroup} instance are duplicated on the directive itself, so a reference to it
* will give you access to the aggregate value and validity status of the form, as well as
* user interaction properties like `dirty` and `touched`.
*
* An Angular form is a collection of `FormControl`s in some hierarchy.
* `FormControl`s can be at the top level or can be organized in `FormGroup`s
* or `FormArray`s. This hierarchy is reflected in the form's `value`, a
* JSON object that mirrors the form structure.
* To register child controls with the form, you'll want to use {@link NgModel} with a
* `name` attribute. You can also use {@link NgModelGroup} if you'd like to create
* sub-groups within the form.
*
* ### Submission
* You can listen to the directive's `ngSubmit` event to be notified when the user has
* triggered a form submission.
*
* The `ngSubmit` event signals when the user triggers a form submission.
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <p>Submit the form to see the data object Angular builds</p>
* <h2>NgForm demo</h2>
* <form #f="ngForm" (ngSubmit)="onSubmit(f.value)">
* <h3>Control group: credentials</h3>
* <div ngModelGroup="credentials">
* <p>Login: <input type="text" name="login" ngModel></p>
* <p>Password: <input type="password" name="password" ngModel></p>
* </div>
* <h3>Control group: person</h3>
* <div ngModelGroup="person">
* <p>First name: <input type="text" name="firstName" ngModel></p>
* <p>Last name: <input type="text" name="lastName" ngModel></p>
* </div>
* <button type="submit">Submit Form</button>
* <p>Form data submitted:</p>
* </form>
* <pre>{{data}}</pre>
* </div>
* `,
* directives: []
* })
* export class App {
* constructor() {}
* * **npm package**: `@angular/forms`
*
* data: string;
* * **NgModule**: `FormsModule`
*
* onSubmit(data) {
* this.data = JSON.stringify(data, null, 2);
* }
* }
* ```
*
* @stable

@@ -85,0 +56,0 @@ */

@@ -13,36 +13,24 @@ /**

/**
* Creates and binds a model group to a DOM element.
* @whatItDoes Creates and binds a {@link FormGroup} instance to a DOM element.
*
* This directive can only be used as a child of {@link NgForm}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular forms Example</h2>
* <form #f="ngForm">
* <div ngModelGroup="name" #mgName="ngModelGroup">
* <h3>Enter your name:</h3>
* <p>First: <input name="first" ngModel required></p>
* <p>Middle: <input name="middle" ngModel></p>
* <p>Last: <input name="last" ngModel required></p>
* </div>
* <h3>Name value:</h3>
* <pre>{{ mgName.value | json }}</pre>
* <p>Name is {{mgName?.valid ? "valid" : "invalid"}}</p>
* <h3>What's your favorite food?</h3>
* <p><input name="food" ngModel></p>
* <h3>Form value</h3>
* <pre>{{ f.value | json }}</pre>
* </form>
* </div>
* `
* })
* export class App {}
* ```
* This directive can only be used as a child of {@link NgForm} (or in other words,
* within `<form>` tags).
*
* This example declares a model group for a user's name. The value and validation state of
* this group can be accessed separately from the overall form.
* Use this directive if you'd like to create a sub-group within a form. This can
* come in handy if you want to validate a sub-group of your form separately from
* the rest of your form, or if some values in your domain model make more sense to
* consume together in a nested object.
*
* Pass in the name you'd like this sub-group to have and it will become the key
* for the sub-group in the form's full value. You can also export the directive into
* a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
*
* {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `FormsModule`
*
* @stable

@@ -49,0 +37,0 @@ */

@@ -24,36 +24,24 @@ /**

/**
* Creates and binds a model group to a DOM element.
* @whatItDoes Creates and binds a {@link FormGroup} instance to a DOM element.
*
* This directive can only be used as a child of {@link NgForm}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular forms Example</h2>
* <form #f="ngForm">
* <div ngModelGroup="name" #mgName="ngModelGroup">
* <h3>Enter your name:</h3>
* <p>First: <input name="first" ngModel required></p>
* <p>Middle: <input name="middle" ngModel></p>
* <p>Last: <input name="last" ngModel required></p>
* </div>
* <h3>Name value:</h3>
* <pre>{{ mgName.value | json }}</pre>
* <p>Name is {{mgName?.valid ? "valid" : "invalid"}}</p>
* <h3>What's your favorite food?</h3>
* <p><input name="food" ngModel></p>
* <h3>Form value</h3>
* <pre>{{ f.value | json }}</pre>
* </form>
* </div>
* `
* })
* export class App {}
* ```
* This directive can only be used as a child of {@link NgForm} (or in other words,
* within `<form>` tags).
*
* This example declares a model group for a user's name. The value and validation state of
* this group can be accessed separately from the overall form.
* Use this directive if you'd like to create a sub-group within a form. This can
* come in handy if you want to validate a sub-group of your form separately from
* the rest of your form, or if some values in your domain model make more sense to
* consume together in a nested object.
*
* Pass in the name you'd like this sub-group to have and it will become the key
* for the sub-group in the form's full value. You can also export the directive into
* a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
*
* {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `FormsModule`
*
* @stable

@@ -60,0 +48,0 @@ */

@@ -17,21 +17,52 @@ /**

/**
* Binds a domain model to a form control.
* @whatItDoes Creates a {@link FormControl} instance from a domain model and binds it
* to a form control element.
*
* ### Usage
* The {@link FormControl} instance will track the value, user interaction, and
* validation status of the control and keep the view synced with the model. If used
* within a parent form, the directive will also register itself with the form as a child
* control.
*
* `ngModel` binds an existing domain model to a form control. For a
* two-way binding, use `[(ngModel)]` to ensure the model updates in
* both directions.
* @howToUse
*
* ```typescript
* @Component({
* selector: "search-comp",
* directives: [],
* template: `<input type='text' [(ngModel)]="searchQuery">`
* })
* class SearchComp {
* searchQuery: string;
* }
* ```
* This directive can be used by itself or as part of a larger form. All you need is the
* `ngModel` selector to activate it.
*
* It accepts a domain model as an optional {@link @Input}. If you have a one-way binding
* to `ngModel` with `[]` syntax, changing the value of the domain model in the component
* class will set the value in the view. If you have a two-way binding with `[()]` syntax
* (also known as 'banana-box syntax'), the value in the UI will always be synced back to
* the domain model in your class as well.
*
* If you wish to inspect the properties of the associated {@link FormControl} (like
* validity state), you can also export the directive into a local template variable using
* `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the
* directive's `control` property, but most properties you'll need (like `valid` and `dirty`)
* will fall through to the control anyway, so you can access them directly. You can see a
* full list of properties directly available in {@link AbstractControlDirective}.
*
* The following is an example of a simple standalone control using `ngModel`:
*
* {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
*
* When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
* so that the control can be registered with the parent form under that name.
*
* It's worth noting that in the context of a parent form, you often can skip one-way or
* two-way binding because the parent form will sync the value for you. You can access
* its properties by exporting it into a local template variable using `ngForm` (ex:
* `#f="ngForm"`). Then you can pass it where it needs to go on submit.
*
* If you do need to populate initial values into your form, using a one-way binding for
* `ngModel` tends to be sufficient as long as you use the exported form's value rather
* than the domain model's value on submit.
*
* Take a look at an example of using `ngModel` within a form:
*
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* **npm package**: `@angular/forms`
*
* **NgModule**: `FormsModule`
*
* @stable

@@ -38,0 +69,0 @@ */

@@ -31,21 +31,52 @@ /**

/**
* Binds a domain model to a form control.
* @whatItDoes Creates a {@link FormControl} instance from a domain model and binds it
* to a form control element.
*
* ### Usage
* The {@link FormControl} instance will track the value, user interaction, and
* validation status of the control and keep the view synced with the model. If used
* within a parent form, the directive will also register itself with the form as a child
* control.
*
* `ngModel` binds an existing domain model to a form control. For a
* two-way binding, use `[(ngModel)]` to ensure the model updates in
* both directions.
* @howToUse
*
* ```typescript
* @Component({
* selector: "search-comp",
* directives: [],
* template: `<input type='text' [(ngModel)]="searchQuery">`
* })
* class SearchComp {
* searchQuery: string;
* }
* ```
* This directive can be used by itself or as part of a larger form. All you need is the
* `ngModel` selector to activate it.
*
* It accepts a domain model as an optional {@link @Input}. If you have a one-way binding
* to `ngModel` with `[]` syntax, changing the value of the domain model in the component
* class will set the value in the view. If you have a two-way binding with `[()]` syntax
* (also known as 'banana-box syntax'), the value in the UI will always be synced back to
* the domain model in your class as well.
*
* If you wish to inspect the properties of the associated {@link FormControl} (like
* validity state), you can also export the directive into a local template variable using
* `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the
* directive's `control` property, but most properties you'll need (like `valid` and `dirty`)
* will fall through to the control anyway, so you can access them directly. You can see a
* full list of properties directly available in {@link AbstractControlDirective}.
*
* The following is an example of a simple standalone control using `ngModel`:
*
* {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
*
* When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
* so that the control can be registered with the parent form under that name.
*
* It's worth noting that in the context of a parent form, you often can skip one-way or
* two-way binding because the parent form will sync the value for you. You can access
* its properties by exporting it into a local template variable using `ngForm` (ex:
* `#f="ngForm"`). Then you can pass it where it needs to go on submit.
*
* If you do need to populate initial values into your form, using a one-way binding for
* `ngModel` tends to be sufficient as long as you use the exported form's value rather
* than the domain model's value on submit.
*
* Take a look at an example of using `ngModel` within a form:
*
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* **npm package**: `@angular/forms`
*
* **NgModule**: `FormsModule`
*
* @stable

@@ -52,0 +83,0 @@ */

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":75,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":75,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkForErrors":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}],"_updateDisabled":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"./ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"NgModel"}},"NgModel":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ngModel]:not([formControlName]):not([formControl])","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngModel"}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"options":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModelOptions"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"./control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":106,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":106,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}],"_isStandalone":[{"__symbolic":"method"}],"_setUpStandalone":[{"__symbolic":"method"}],"_checkForErrors":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}],"_checkName":[{"__symbolic":"method"}],"_updateValue":[{"__symbolic":"method"}],"_updateDisabled":[{"__symbolic":"method"}]}}}}

@@ -9,3 +9,3 @@ /**

import { Directive, ElementRef, Renderer, forwardRef } from '@angular/core';
import { NumberWrapper, isBlank } from '../facade/lang';
import { isBlank } from '../facade/lang';
import { NG_VALUE_ACCESSOR } from './control_value_accessor';

@@ -39,3 +39,3 @@ export var NUMBER_VALUE_ACCESSOR = {

NumberValueAccessor.prototype.registerOnChange = function (fn) {
this.onChange = function (value) { fn(value == '' ? null : NumberWrapper.parseFloat(value)); };
this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); };
};

@@ -42,0 +42,0 @@ NumberValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };

@@ -10,3 +10,2 @@ /**

import { ListWrapper } from '../facade/collection';
import { isPresent } from '../facade/lang';
import { NG_VALUE_ACCESSOR } from './control_value_accessor';

@@ -93,5 +92,3 @@ import { NgControl } from './ng_control';

this._state = value === this.value;
if (isPresent(value)) {
this._renderer.setElementProperty(this._elementRef.nativeElement, 'checked', this._state);
}
this._renderer.setElementProperty(this._elementRef.nativeElement, 'checked', this._state);
};

@@ -98,0 +95,0 @@ RadioControlValueAccessor.prototype.registerOnChange = function (fn) {

@@ -16,48 +16,41 @@ /**

/**
* Binds an existing {@link FormControl} to a DOM element. It requires importing the {@link
* ReactiveFormsModule}.
* @whatItDoes Syncs a standalone {@link FormControl} instance to a form control element.
*
* In this example, we bind the control to an input element. When the value of the input element
* changes, the value of the control will reflect that change. Likewise, if the value of the
* control changes, the input element reflects that change.
* In other words, this directive ensures that any values written to the {@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {@link FormControl} instance (view -> model).
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Bind existing control example</h2>
* <form>
* <p>Element with existing control: <input type="text"
* [formControl]="loginControl"></p>
* <p>Value of existing control: {{loginControl.value}}</p>
* </form>
* </div>
* `,
* })
* export class App {
* loginControl: FormControl = new FormControl('');
* }
* ```
* @howToUse
*
* ### ngModel
* Use this directive if you'd like to create and manage a {@link FormControl} instance directly.
* Simply create a {@link FormControl}, save it to your component class, and pass it into the
* {@link FormControlDirective}.
*
* We can also set the value of the form programmatically with setValue().
**
* ```typescript
* @Component({
* selector: "login-comp",
* template: "<input type='text' [formControl]='loginControl'>"
* })
* class LoginComp {
* loginControl: FormControl = new FormControl('');
* This directive is designed to be used as a standalone control. Unlike {@link FormControlName},
* it does not require that your {@link FormControl} instance be part of any parent
* {@link FormGroup}, and it won't be registered to any {@link FormGroupDirective} that
* exists above it.
*
* populate() {
* this.loginControl.setValue('some login');
* }
* **Get the value**: the `value` property is always synced and available on the
* {@link FormControl} instance. See a full list of available properties in
* {@link AbstractControl}.
*
* }
* ```
* **Set the value**: You can pass in an initial value when instantiating the {@link FormControl},
* or you can set it programmatically later using {@link AbstractControl.setValue} or
* {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -64,0 +57,0 @@ */

@@ -26,48 +26,41 @@ /**

/**
* Binds an existing {@link FormControl} to a DOM element. It requires importing the {@link
* ReactiveFormsModule}.
* @whatItDoes Syncs a standalone {@link FormControl} instance to a form control element.
*
* In this example, we bind the control to an input element. When the value of the input element
* changes, the value of the control will reflect that change. Likewise, if the value of the
* control changes, the input element reflects that change.
* In other words, this directive ensures that any values written to the {@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {@link FormControl} instance (view -> model).
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Bind existing control example</h2>
* <form>
* <p>Element with existing control: <input type="text"
* [formControl]="loginControl"></p>
* <p>Value of existing control: {{loginControl.value}}</p>
* </form>
* </div>
* `,
* })
* export class App {
* loginControl: FormControl = new FormControl('');
* }
* ```
* @howToUse
*
* ### ngModel
* Use this directive if you'd like to create and manage a {@link FormControl} instance directly.
* Simply create a {@link FormControl}, save it to your component class, and pass it into the
* {@link FormControlDirective}.
*
* We can also set the value of the form programmatically with setValue().
**
* ```typescript
* @Component({
* selector: "login-comp",
* template: "<input type='text' [formControl]='loginControl'>"
* })
* class LoginComp {
* loginControl: FormControl = new FormControl('');
* This directive is designed to be used as a standalone control. Unlike {@link FormControlName},
* it does not require that your {@link FormControl} instance be part of any parent
* {@link FormGroup}, and it won't be registered to any {@link FormGroupDirective} that
* exists above it.
*
* populate() {
* this.loginControl.setValue('some login');
* }
* **Get the value**: the `value` property is always synced and available on the
* {@link FormControl} instance. See a full list of available properties in
* {@link AbstractControl}.
*
* }
* ```
* **Set the value**: You can pass in an initial value when instantiating the {@link FormControl},
* or you can set it programmatically later using {@link AbstractControl.setValue} or
* {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -74,0 +67,0 @@ */

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlDirective"}},"FormControlDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControl]","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControl"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":87,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":87,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_isControlChanged":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"formControlBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlDirective"}},"FormControlDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControl]","providers":[{"__symbolic":"reference","name":"formControlBinding"}],"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControl"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":80,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":80,"character":86}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_isControlChanged":[{"__symbolic":"method"}]}}}}

@@ -17,66 +17,45 @@ /**

/**
* Syncs an existing form control with the specified name to a DOM element.
* @whatItDoes Syncs a {@link FormControl} in an existing {@link FormGroup} to a form control
* element by name.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* ### Example
* In other words, this directive ensures that any values written to the {@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {@link FormControl} instance (view -> model).
*
* In this example, we create the login and password controls.
* We can work with each control separately: check its validity, get its value, listen to its
* changes.
* @howToUse
*
* ```
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]="myForm" (submit)="onLogIn()">
* Login <input type="text" formControlName="login">
* <div *ngIf="!loginCtrl.valid">Login is invalid</div>
* Password <input type="password" formControlName="password">
* <button type="submit">Log in!</button>
* </form>
* `})
* class LoginComp {
* loginCtrl = new FormControl();
* passwordCtrl = new FormControl();
* myForm = new FormGroup({
* login: loginCtrl,
* password: passwordCtrl
* });
* onLogIn(): void {
* // value === {login: 'some login', password: 'some password'}
* }
* }
* ```
* This directive is designed to be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* We can also set the value of the form programmatically using setValue().
* It accepts the string name of the {@link FormControl} instance you want to
* link, and will look for a {@link FormControl} registered with that name in the
* closest {@link FormGroup} or {@link FormArray} above it.
*
* ```
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]="myForm" (submit)='onLogIn()'>
* Login <input type='text' formControlName='login'>
* Password <input type='password' formControlName='password'>
* <button type='submit'>Log in!</button>
* </form>
* `})
* class LoginComp {
* myForm = new FormGroup({
* login: new FormControl(),
* password: new FormControl()
* });
* **Access the control**: You can access the {@link FormControl} associated with
* this directive by using the {@link AbstractControl.get} method.
* Ex: `this.form.get('first');`
*
* populate() {
* this.myForm.setValue({login: 'some login', password: 'some password'});
* }
* **Get value**: the `value` property is always synced and available on the {@link FormControl}.
* See a full list of available properties in {@link AbstractControl}.
*
* onLogIn(): void {
* // this.credentials.login === "some login"
* // this.credentials.password === "some password"
* }
* }
* ```
* **Set value**: You can set an initial value for the control when instantiating the
* {@link FormControl}, or you can set it programmatically later using
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* In this example, we create form controls for first name and last name.
*
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: {@link ReactiveFormsModule}
*
* @stable

@@ -100,2 +79,3 @@ */

private _checkParentType();
private _setUpControl();
}

@@ -29,66 +29,45 @@ /**

/**
* Syncs an existing form control with the specified name to a DOM element.
* @whatItDoes Syncs a {@link FormControl} in an existing {@link FormGroup} to a form control
* element by name.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* ### Example
* In other words, this directive ensures that any values written to the {@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {@link FormControl} instance (view -> model).
*
* In this example, we create the login and password controls.
* We can work with each control separately: check its validity, get its value, listen to its
* changes.
* @howToUse
*
* ```
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]="myForm" (submit)="onLogIn()">
* Login <input type="text" formControlName="login">
* <div *ngIf="!loginCtrl.valid">Login is invalid</div>
* Password <input type="password" formControlName="password">
* <button type="submit">Log in!</button>
* </form>
* `})
* class LoginComp {
* loginCtrl = new FormControl();
* passwordCtrl = new FormControl();
* myForm = new FormGroup({
* login: loginCtrl,
* password: passwordCtrl
* });
* onLogIn(): void {
* // value === {login: 'some login', password: 'some password'}
* }
* }
* ```
* This directive is designed to be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* We can also set the value of the form programmatically using setValue().
* It accepts the string name of the {@link FormControl} instance you want to
* link, and will look for a {@link FormControl} registered with that name in the
* closest {@link FormGroup} or {@link FormArray} above it.
*
* ```
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]="myForm" (submit)='onLogIn()'>
* Login <input type='text' formControlName='login'>
* Password <input type='password' formControlName='password'>
* <button type='submit'>Log in!</button>
* </form>
* `})
* class LoginComp {
* myForm = new FormGroup({
* login: new FormControl(),
* password: new FormControl()
* });
* **Access the control**: You can access the {@link FormControl} associated with
* this directive by using the {@link AbstractControl.get} method.
* Ex: `this.form.get('first');`
*
* populate() {
* this.myForm.setValue({login: 'some login', password: 'some password'});
* }
* **Get value**: the `value` property is always synced and available on the {@link FormControl}.
* See a full list of available properties in {@link AbstractControl}.
*
* onLogIn(): void {
* // this.credentials.login === "some login"
* // this.credentials.password === "some password"
* }
* }
* ```
* **Set value**: You can set an initial value for the control when instantiating the
* {@link FormControl}, or you can set it programmatically later using
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* In this example, we create form controls for first name and last name.
*
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: {@link ReactiveFormsModule}
*
* @stable

@@ -113,9 +92,4 @@ */

FormControlName.prototype.ngOnChanges = function (changes) {
if (!this._added) {
this._checkParentType();
this.formDirective.addControl(this);
if (this.control.disabled)
this.valueAccessor.setDisabledState(true);
this._added = true;
}
if (!this._added)
this._setUpControl();
if (isPropertyUpdated(changes, this.viewModel)) {

@@ -158,3 +132,3 @@ this.viewModel = this.model;

Object.defineProperty(FormControlName.prototype, "control", {
get: function () { return this.formDirective.getControl(this); },
get: function () { return this._control; },
enumerable: true,

@@ -173,2 +147,9 @@ configurable: true

};
FormControlName.prototype._setUpControl = function () {
this._checkParentType();
this._control = this.formDirective.addControl(this);
if (this.control.disabled)
this.valueAccessor.setDisabledState(true);
this._added = true;
};
FormControlName.decorators = [

@@ -175,0 +156,0 @@ { type: Directive, args: [{ selector: '[formControlName]', providers: [controlNameBinding] },] },

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":114,"character":16}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":114,"character":16}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"controlNameBinding":{"provide":{"__symbolic":"reference","module":"../ng_control","name":"NgControl"},"useExisting":{"__symbolic":"reference","name":"FormControlName"}},"FormControlName":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formControlName]","providers":[{"__symbolic":"reference","name":"controlNameBinding"}]}]}],"members":{"name":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formControlName"]}]}],"model":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["ngModel"]}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"},"arguments":["ngModelChange"]}]}],"isDisabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["disabled"]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Host"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf"}}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"NG_VALUE_ACCESSOR"}]}]],"parameters":[{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":95,"character":16}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"error","message":"Expression form not supported","line":95,"character":16}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"../control_value_accessor","name":"ControlValueAccessor"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"viewToModelUpdate":[{"__symbolic":"method"}],"_checkParentType":[{"__symbolic":"method"}],"_setUpControl":[{"__symbolic":"method"}]}}}}

@@ -13,72 +13,33 @@ /**

import { Form } from '../form_interface';
import { NgControl } from '../ng_control';
import { FormControlName } from './form_control_name';
import { FormArrayName, FormGroupName } from './form_group_name';
export declare const formDirectiveProvider: any;
/**
* Binds an existing form group to a DOM element. It requires importing the {@link
* ReactiveFormsModule}.
* @whatItDoes Binds an existing {@link FormGroup} to a DOM element.
*
* In this example, we bind the form group to the form element, and we bind the login and
* password controls to the login and password elements.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Binding an existing form group</h2>
* <form [formGroup]="loginForm">
* <p>Login: <input type="text" formControlName="login"></p>
* <p>Password: <input type="password" formControlName="password"></p>
* </form>
* <p>Value:</p>
* <pre>{{ loginForm.value | json}}</pre>
* </div>
* `
* })
* export class App {
* loginForm: FormGroup;
* This directive accepts an existing {@link FormGroup} instance. It will then use this
* {@link FormGroup} instance to match any child {@link FormControl}, {@link FormGroup},
* and {@link FormArray} instances to child {@link FormControlName}, {@link FormGroupName},
* and {@link FormArrayName} directives.
*
* constructor() {
* this.loginForm = new FormGroup({
* login: new FormControl(""),
* password: new FormControl("")
* });
* }
* **Set value**: You can set the form's initial value when instantiating the
* {@link FormGroup}, or you can set it programmatically later using the {@link FormGroup}'s
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue} methods.
*
* }
* ```
* **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe
* to the {@link FormGroup}'s {@link AbstractControl.valueChanges} event. You can also listen to
* its {@link AbstractControl.statusChanges} event to be notified when the validation status is
* re-calculated.
*
* We can also use setValue() to populate the form programmatically.
* ### Example
*
* ```typescript
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]='loginForm'>
* Login <input type='text' formControlName='login'>
* Password <input type='password' formControlName='password'>
* <button (click)="onLogin()">Login</button>
* </form>`
* })
* class LoginComp {
* loginForm: FormGroup;
* In this example, we create form controls for first name and last name.
*
* constructor() {
* this.loginForm = new FormGroup({
* login: new FormControl(''),
* password: new FormControl('')
* });
* }
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* populate() {
* this.loginForm.setValue({ login: 'some login', password: 'some password'});
* }
* **npm package**: `@angular/forms`
*
* onLogin(): void {
* // this.credentials.login === 'some login'
* // this.credentials.password === 'some password'
* }
* }
* ```
* **NgModule**: {@link ReactiveFormsModule}
*

@@ -91,3 +52,4 @@ * @stable

private _submitted;
directives: NgControl[];
private _oldForm;
directives: FormControlName[];
form: FormGroup;

@@ -101,5 +63,5 @@ ngSubmit: EventEmitter<{}>;

path: string[];
addControl(dir: NgControl): void;
getControl(dir: NgControl): FormControl;
removeControl(dir: NgControl): void;
addControl(dir: FormControlName): FormControl;
getControl(dir: FormControlName): FormControl;
removeControl(dir: FormControlName): void;
addFormGroup(dir: FormGroupName): void;

@@ -111,7 +73,9 @@ removeFormGroup(dir: FormGroupName): void;

getFormArray(dir: FormArrayName): FormArray;
updateModel(dir: NgControl, value: any): void;
updateModel(dir: FormControlName, value: any): void;
onSubmit(): boolean;
onReset(): void;
resetForm(value?: any): void;
private _updateRegistrations();
private _updateValidators();
private _checkFormPresent();
}

@@ -26,68 +26,29 @@ /**

/**
* Binds an existing form group to a DOM element. It requires importing the {@link
* ReactiveFormsModule}.
* @whatItDoes Binds an existing {@link FormGroup} to a DOM element.
*
* In this example, we bind the form group to the form element, and we bind the login and
* password controls to the login and password elements.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Binding an existing form group</h2>
* <form [formGroup]="loginForm">
* <p>Login: <input type="text" formControlName="login"></p>
* <p>Password: <input type="password" formControlName="password"></p>
* </form>
* <p>Value:</p>
* <pre>{{ loginForm.value | json}}</pre>
* </div>
* `
* })
* export class App {
* loginForm: FormGroup;
* This directive accepts an existing {@link FormGroup} instance. It will then use this
* {@link FormGroup} instance to match any child {@link FormControl}, {@link FormGroup},
* and {@link FormArray} instances to child {@link FormControlName}, {@link FormGroupName},
* and {@link FormArrayName} directives.
*
* constructor() {
* this.loginForm = new FormGroup({
* login: new FormControl(""),
* password: new FormControl("")
* });
* }
* **Set value**: You can set the form's initial value when instantiating the
* {@link FormGroup}, or you can set it programmatically later using the {@link FormGroup}'s
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue} methods.
*
* }
* ```
* **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe
* to the {@link FormGroup}'s {@link AbstractControl.valueChanges} event. You can also listen to
* its {@link AbstractControl.statusChanges} event to be notified when the validation status is
* re-calculated.
*
* We can also use setValue() to populate the form programmatically.
* ### Example
*
* ```typescript
* @Component({
* selector: "login-comp",
* template: `
* <form [formGroup]='loginForm'>
* Login <input type='text' formControlName='login'>
* Password <input type='password' formControlName='password'>
* <button (click)="onLogin()">Login</button>
* </form>`
* })
* class LoginComp {
* loginForm: FormGroup;
* In this example, we create form controls for first name and last name.
*
* constructor() {
* this.loginForm = new FormGroup({
* login: new FormControl(''),
* password: new FormControl('')
* });
* }
* {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* populate() {
* this.loginForm.setValue({ login: 'some login', password: 'some password'});
* }
* **npm package**: `@angular/forms`
*
* onLogin(): void {
* // this.credentials.login === 'some login'
* // this.credentials.password === 'some password'
* }
* }
* ```
* **NgModule**: {@link ReactiveFormsModule}
*

@@ -110,7 +71,5 @@ * @stable

if (StringMapWrapper.contains(changes, 'form')) {
var sync = composeValidators(this._validators);
this.form.validator = Validators.compose([this.form.validator, sync]);
var async = composeAsyncValidators(this._asyncValidators);
this.form.asyncValidator = Validators.composeAsync([this.form.asyncValidator, async]);
this._updateDomValue(changes);
this._updateValidators();
this._updateDomValue();
this._updateRegistrations();
}

@@ -143,2 +102,3 @@ };

this.directives.push(dir);
return ctrl;
};

@@ -177,12 +137,11 @@ FormGroupDirective.prototype.getControl = function (dir) { return this.form.get(dir.path); };

/** @internal */
FormGroupDirective.prototype._updateDomValue = function (changes) {
FormGroupDirective.prototype._updateDomValue = function () {
var _this = this;
var oldForm = changes['form'].previousValue;
this.directives.forEach(function (dir) {
var newCtrl = _this.form.get(dir.path);
var oldCtrl = oldForm.get(dir.path);
if (oldCtrl !== newCtrl) {
cleanUpControl(oldCtrl, dir);
if (dir._control !== newCtrl) {
cleanUpControl(dir._control, dir);
if (newCtrl)
setUpControl(newCtrl, dir);
dir._control = newCtrl;
}

@@ -192,2 +151,15 @@ });

};
FormGroupDirective.prototype._updateRegistrations = function () {
var _this = this;
this.form._registerOnCollectionChange(function () { return _this._updateDomValue(); });
if (this._oldForm)
this._oldForm._registerOnCollectionChange(function () { });
this._oldForm = this.form;
};
FormGroupDirective.prototype._updateValidators = function () {
var sync = composeValidators(this._validators);
this.form.validator = Validators.compose([this.form.validator, sync]);
var async = composeAsyncValidators(this._asyncValidators);
this.form.asyncValidator = Validators.composeAsync([this.form.asyncValidator, async]);
};
FormGroupDirective.prototype._checkFormPresent = function () {

@@ -194,0 +166,0 @@ if (isBlank(this.form)) {

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"resetForm":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"formDirectiveProvider":{"provide":{"__symbolic":"reference","module":"../control_container","name":"ControlContainer"},"useExisting":{"__symbolic":"reference","name":"FormGroupDirective"}},"FormGroupDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[formGroup]","providers":[{"__symbolic":"reference","name":"formDirectiveProvider"}],"host":{"(submit)":"onSubmit()","(reset)":"onReset()"},"exportAs":"ngForm"}]}],"members":{"form":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["formGroup"]}]}],"ngSubmit":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_VALIDATORS"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Self"}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"../../validators","name":"NG_ASYNC_VALIDATORS"}]}]],"parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"ngOnChanges":[{"__symbolic":"method"}],"addControl":[{"__symbolic":"method"}],"getControl":[{"__symbolic":"method"}],"removeControl":[{"__symbolic":"method"}],"addFormGroup":[{"__symbolic":"method"}],"removeFormGroup":[{"__symbolic":"method"}],"getFormGroup":[{"__symbolic":"method"}],"addFormArray":[{"__symbolic":"method"}],"removeFormArray":[{"__symbolic":"method"}],"getFormArray":[{"__symbolic":"method"}],"updateModel":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"onReset":[{"__symbolic":"method"}],"resetForm":[{"__symbolic":"method"}],"_updateDomValue":[{"__symbolic":"method"}],"_updateRegistrations":[{"__symbolic":"method"}],"_updateValidators":[{"__symbolic":"method"}],"_checkFormPresent":[{"__symbolic":"method"}]}}}}

@@ -16,46 +16,43 @@ /**

/**
* Syncs an existing form group to a DOM element.
* @whatItDoes Syncs a nested {@link FormGroup} to a DOM element.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular FormGroup Example</h2>
* <form [formGroup]="myForm">
* <div formGroupName="name">
* <h3>Enter your name:</h3>
* <p>First: <input formControlName="first"></p>
* <p>Middle: <input formControlName="middle"></p>
* <p>Last: <input formControlName="last"></p>
* </div>
* <h3>Name value:</h3>
* <pre>{{ myForm.get('name') | json }}</pre>
* <p>Name is {{myForm.get('name')?.valid ? "valid" : "invalid"}}</p>
* <h3>What's your favorite food?</h3>
* <p><input formControlName="food"></p>
* <h3>Form value</h3>
* <pre> {{ myForm | json }} </pre>
* </form>
* </div>
* `
* })
* export class App {
* myForm = new FormGroup({
* name: new FormGroup({
* first: new FormControl('', Validators.required),
* middle: new FormControl(''),
* last: new FormControl('', Validators.required)
* }),
* food: new FormControl()
* });
* }
* ```
* This directive can only be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* This example syncs the form group for the user's name. The value and validation state of
* this group can be accessed separately from the overall form.
* It accepts the string name of the nested {@link FormGroup} you want to link, and
* will look for a {@link FormGroup} registered with that name in the parent
* {@link FormGroup} instance you passed into {@link FormGroupDirective}.
*
* Nested form groups can come in handy when you want to validate a sub-group of a
* form separately from the rest or when you'd like to group the values of certain
* controls into their own nested object.
*
* **Access the group**: You can access the associated {@link FormGroup} using the
* {@link AbstractControl.get} method. Ex: `this.form.get('name')`.
*
* You can also access individual controls within the group using dot syntax.
* Ex: `this.form.get('name.first')`
*
* **Get the value**: the `value` property is always synced and available on the
* {@link FormGroup}. See a full list of available properties in {@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {@link FormGroup}, or you can set it programmatically later using
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the group, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -69,35 +66,46 @@ */

/**
* Syncs an existing form array to a DOM element.
* @whatItDoes Syncs a nested {@link FormArray} to a DOM element.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular FormArray Example</h2>
* <form [formGroup]="myForm">
* <div formArrayName="cities">
* <div *ngFor="let city of cityArray.controls; let i=index">
* <input [formControlName]="i">
* </div>
* </div>
* </form>
* {{ myForm.value | json }} // {cities: ['SF', 'NY']}
* </div>
* `
* })
* export class App {
* cityArray = new FormArray([
* new FormControl('SF'),
* new FormControl('NY')
* ]);
* myForm = new FormGroup({
* cities: this.cityArray
* });
* }
* ```
* This directive is designed to be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* It accepts the string name of the nested {@link FormArray} you want to link, and
* will look for a {@link FormArray} registered with that name in the parent
* {@link FormGroup} instance you passed into {@link FormGroupDirective}.
*
* Nested form arrays can come in handy when you have a group of form controls but
* you're not sure how many there will be. Form arrays allow you to create new
* form controls dynamically.
*
* **Access the array**: You can access the associated {@link FormArray} using the
* {@link AbstractControl.get} method on the parent {@link FormGroup}.
* Ex: `this.form.get('cities')`.
*
* **Get the value**: the `value` property is always synced and available on the
* {@link FormArray}. See a full list of available properties in {@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {@link FormArray}, or you can set the value programmatically later using the
* {@link FormArray}'s {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}
* methods.
*
* **Listen to value**: If you want to listen to changes in the value of the array, you can
* subscribe to the {@link FormArray}'s {@link AbstractControl.valueChanges} event. You can also
* listen to its {@link AbstractControl.statusChanges} event to be notified when the validation
* status is re-calculated.
*
* **Add new controls**: You can add new controls to the {@link FormArray} dynamically by
* calling its {@link FormArray.push} method.
* Ex: `this.form.get('cities').push(new FormControl());`
*
* ### Example
*
* {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -104,0 +112,0 @@ */

@@ -25,46 +25,43 @@ /**

/**
* Syncs an existing form group to a DOM element.
* @whatItDoes Syncs a nested {@link FormGroup} to a DOM element.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular FormGroup Example</h2>
* <form [formGroup]="myForm">
* <div formGroupName="name">
* <h3>Enter your name:</h3>
* <p>First: <input formControlName="first"></p>
* <p>Middle: <input formControlName="middle"></p>
* <p>Last: <input formControlName="last"></p>
* </div>
* <h3>Name value:</h3>
* <pre>{{ myForm.get('name') | json }}</pre>
* <p>Name is {{myForm.get('name')?.valid ? "valid" : "invalid"}}</p>
* <h3>What's your favorite food?</h3>
* <p><input formControlName="food"></p>
* <h3>Form value</h3>
* <pre> {{ myForm | json }} </pre>
* </form>
* </div>
* `
* })
* export class App {
* myForm = new FormGroup({
* name: new FormGroup({
* first: new FormControl('', Validators.required),
* middle: new FormControl(''),
* last: new FormControl('', Validators.required)
* }),
* food: new FormControl()
* });
* }
* ```
* This directive can only be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* This example syncs the form group for the user's name. The value and validation state of
* this group can be accessed separately from the overall form.
* It accepts the string name of the nested {@link FormGroup} you want to link, and
* will look for a {@link FormGroup} registered with that name in the parent
* {@link FormGroup} instance you passed into {@link FormGroupDirective}.
*
* Nested form groups can come in handy when you want to validate a sub-group of a
* form separately from the rest or when you'd like to group the values of certain
* controls into their own nested object.
*
* **Access the group**: You can access the associated {@link FormGroup} using the
* {@link AbstractControl.get} method. Ex: `this.form.get('name')`.
*
* You can also access individual controls within the group using dot syntax.
* Ex: `this.form.get('name.first')`
*
* **Get the value**: the `value` property is always synced and available on the
* {@link FormGroup}. See a full list of available properties in {@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {@link FormGroup}, or you can set it programmatically later using
* {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the group, you can
* subscribe to the {@link AbstractControl.valueChanges} event. You can also listen to
* {@link AbstractControl.statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -105,35 +102,46 @@ */

/**
* Syncs an existing form array to a DOM element.
* @whatItDoes Syncs a nested {@link FormArray} to a DOM element.
*
* This directive can only be used as a child of {@link FormGroupDirective}. It also requires
* importing the {@link ReactiveFormsModule}.
* @howToUse
*
* ```typescript
* @Component({
* selector: 'my-app',
* template: `
* <div>
* <h2>Angular FormArray Example</h2>
* <form [formGroup]="myForm">
* <div formArrayName="cities">
* <div *ngFor="let city of cityArray.controls; let i=index">
* <input [formControlName]="i">
* </div>
* </div>
* </form>
* {{ myForm.value | json }} // {cities: ['SF', 'NY']}
* </div>
* `
* })
* export class App {
* cityArray = new FormArray([
* new FormControl('SF'),
* new FormControl('NY')
* ]);
* myForm = new FormGroup({
* cities: this.cityArray
* });
* }
* ```
* This directive is designed to be used with a parent {@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* It accepts the string name of the nested {@link FormArray} you want to link, and
* will look for a {@link FormArray} registered with that name in the parent
* {@link FormGroup} instance you passed into {@link FormGroupDirective}.
*
* Nested form arrays can come in handy when you have a group of form controls but
* you're not sure how many there will be. Form arrays allow you to create new
* form controls dynamically.
*
* **Access the array**: You can access the associated {@link FormArray} using the
* {@link AbstractControl.get} method on the parent {@link FormGroup}.
* Ex: `this.form.get('cities')`.
*
* **Get the value**: the `value` property is always synced and available on the
* {@link FormArray}. See a full list of available properties in {@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {@link FormArray}, or you can set the value programmatically later using the
* {@link FormArray}'s {@link AbstractControl.setValue} or {@link AbstractControl.patchValue}
* methods.
*
* **Listen to value**: If you want to listen to changes in the value of the array, you can
* subscribe to the {@link FormArray}'s {@link AbstractControl.valueChanges} event. You can also
* listen to its {@link AbstractControl.statusChanges} event to be notified when the validation
* status is re-calculated.
*
* **Add new controls**: You can add new controls to the {@link FormArray} dynamically by
* calling its {@link FormArray.push} method.
* Ex: `this.form.get('cities').push(new FormControl());`
*
* ### Example
*
* {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* @stable

@@ -140,0 +148,0 @@ */

@@ -51,8 +51,8 @@ /**

dir._rawValidators.forEach(function (validator) {
if (validator.registerOnChange)
validator.registerOnChange(function () { return control.updateValueAndValidity(); });
if (validator.registerOnValidatorChange)
validator.registerOnValidatorChange(function () { return control.updateValueAndValidity(); });
});
dir._rawAsyncValidators.forEach(function (validator) {
if (validator.registerOnChange)
validator.registerOnChange(function () { return control.updateValueAndValidity(); });
if (validator.registerOnValidatorChange)
validator.registerOnValidatorChange(function () { return control.updateValueAndValidity(); });
});

@@ -63,4 +63,4 @@ }

dir.valueAccessor.registerOnTouched(function () { return _noControlError(dir); });
dir._rawValidators.forEach(function (validator) { return validator.registerOnChange(null); });
dir._rawAsyncValidators.forEach(function (validator) { return validator.registerOnChange(null); });
dir._rawValidators.forEach(function (validator) { return validator.registerOnValidatorChange(null); });
dir._rawAsyncValidators.forEach(function (validator) { return validator.registerOnValidatorChange(null); });
if (control)

@@ -67,0 +67,0 @@ control._clearChangeFns();

@@ -33,3 +33,3 @@ /**

};
registerOnChange?(fn: () => void): void;
registerOnValidatorChange?(fn: () => void): void;
}

@@ -56,3 +56,3 @@ export declare const REQUIRED_VALIDATOR: any;

};
registerOnChange(fn: () => void): void;
registerOnValidatorChange(fn: () => void): void;
}

@@ -96,3 +96,3 @@ /**

};
registerOnChange(fn: () => void): void;
registerOnValidatorChange(fn: () => void): void;
}

@@ -123,3 +123,3 @@ /**

};
registerOnChange(fn: () => void): void;
registerOnValidatorChange(fn: () => void): void;
}

@@ -149,3 +149,3 @@ export declare const PATTERN_VALIDATOR: any;

};
registerOnChange(fn: () => void): void;
registerOnValidatorChange(fn: () => void): void;
}

@@ -44,3 +44,3 @@ /**

};
RequiredValidator.prototype.registerOnChange = function (fn) { this._onChange = fn; };
RequiredValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
RequiredValidator.decorators = [

@@ -94,3 +94,3 @@ { type: Directive, args: [{

};
MinLengthValidator.prototype.registerOnChange = function (fn) { this._onChange = fn; };
MinLengthValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
MinLengthValidator.decorators = [

@@ -145,3 +145,3 @@ { type: Directive, args: [{

};
MaxLengthValidator.prototype.registerOnChange = function (fn) { this._onChange = fn; };
MaxLengthValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
MaxLengthValidator.decorators = [

@@ -193,3 +193,3 @@ { type: Directive, args: [{

};
PatternValidator.prototype.registerOnChange = function (fn) { this._onChange = fn; };
PatternValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
PatternValidator.decorators = [

@@ -196,0 +196,0 @@ { type: Directive, args: [{

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"RequiredValidator"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}],"host":{"[attr.required]":"required? \"\" : null"}}]}],"members":{"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"validate":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}]}},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}],"host":{"[attr.minlength]":"minlength? minlength : null"}}]}],"members":{"minlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}],"host":{"[attr.maxlength]":"maxlength? maxlength : null"}}]}],"members":{"maxlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}],"host":{"[attr.pattern]":"pattern? pattern : null"}}]}],"members":{"pattern":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}]}}}}
{"__symbolic":"module","version":1,"metadata":{"REQUIRED_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"RequiredValidator"},"multi":true},"RequiredValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[required][formControlName],[required][formControl],[required][ngModel]","providers":[{"__symbolic":"reference","name":"REQUIRED_VALIDATOR"}],"host":{"[attr.required]":"required? \"\" : null"}}]}],"members":{"required":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"validate":[{"__symbolic":"method"}],"registerOnValidatorChange":[{"__symbolic":"method"}]}},"MIN_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MinLengthValidator"},"multi":true},"MinLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[minlength][formControlName],[minlength][formControl],[minlength][ngModel]","providers":[{"__symbolic":"reference","name":"MIN_LENGTH_VALIDATOR"}],"host":{"[attr.minlength]":"minlength? minlength : null"}}]}],"members":{"minlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnValidatorChange":[{"__symbolic":"method"}]}},"MAX_LENGTH_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"MaxLengthValidator"},"multi":true},"MaxLengthValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]","providers":[{"__symbolic":"reference","name":"MAX_LENGTH_VALIDATOR"}],"host":{"[attr.maxlength]":"maxlength? maxlength : null"}}]}],"members":{"maxlength":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnValidatorChange":[{"__symbolic":"method"}]}},"PATTERN_VALIDATOR":{"provide":{"__symbolic":"reference","module":"../validators","name":"NG_VALIDATORS"},"useExisting":{"__symbolic":"reference","name":"PatternValidator"},"multi":true},"PatternValidator":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[pattern][formControlName],[pattern][formControl],[pattern][ngModel]","providers":[{"__symbolic":"reference","name":"PATTERN_VALIDATOR"}],"host":{"[attr.pattern]":"pattern? pattern : null"}}]}],"members":{"pattern":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"_createValidator":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"registerOnValidatorChange":[{"__symbolic":"method"}]}}}}

@@ -158,5 +158,4 @@ /**

}
var key;
for (var i = 0; i < k1.length; i++) {
key = k1[i];
var key = k1[i];
if (m1[key] !== m2[key]) {

@@ -163,0 +162,0 @@ return false;

@@ -78,3 +78,2 @@

static parseInt(text: string, radix: number): number;
static parseFloat(text: string): number;
static NaN: number;

@@ -81,0 +80,0 @@ static isNumeric(value: any): boolean;

@@ -218,4 +218,2 @@ /**

};
// TODO: NaN is a valid literal but is returned by parseFloat to indicate an error.
NumberWrapper.parseFloat = function (text) { return parseFloat(text); };
Object.defineProperty(NumberWrapper, "NaN", {

@@ -222,0 +220,0 @@ get: function () { return NaN; },

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{"Math":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"Date":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":87,"character":9},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":91,"character":9},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":95,"character":9},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":99,"character":9},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":107,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"then"}]}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":296,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":296,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":314,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":314,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":411,"character":19}}}}
{"__symbolic":"module","version":1,"metadata":{"Math":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"Date":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"isPresent":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"undefined"}},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isBoolean":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":87,"character":9},"right":"boolean"}},"isNumber":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":91,"character":9},"right":"number"}},"isString":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":95,"character":9},"right":"string"}},"isFunction":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":99,"character":9},"right":"function"}},"isType":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":107,"character":9},"right":"object"},"right":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"obj"},"right":null}}},"isStrictStringMap":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isStringMap"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Object"},"member":"getPrototypeOf"},"arguments":[{}]}}}},"isPromise":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isPresent"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isFunction"},"arguments":[{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"then"}]}}},"isArray":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"Array"},"member":"isArray"},"arguments":[{"__symbolic":"reference","name":"obj"}]}},"isDate":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"instanceof","left":{"__symbolic":"reference","name":"obj"},"right":{"__symbolic":"reference","name":"Date"}},"right":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"obj"},"member":"valueOf"}}]}}}},"serializeEnum":{"__symbolic":"function","parameters":["val"],"value":{"__symbolic":"reference","name":"val"}},"deserializeEnum":{"__symbolic":"function","parameters":["val","values"],"value":{"__symbolic":"reference","name":"val"}},"resolveEnumToken":{"__symbolic":"function","parameters":["enumValue","val"],"value":{"__symbolic":"index","expression":{"__symbolic":"reference","name":"enumValue"},"index":{"__symbolic":"reference","name":"val"}}},"RegExp":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}},"looseIdentical":{"__symbolic":"function","parameters":["a","b"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"reference","name":"a"},"right":{"__symbolic":"reference","name":"b"}},"right":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":293,"character":20},"right":"number"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":293,"character":45},"right":"number"}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"a"}]}},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isNaN"},"arguments":[{"__symbolic":"reference","name":"b"}]}}}},"getMapKey":{"__symbolic":"function","parameters":["value"],"value":{"__symbolic":"reference","name":"value"}},"normalizeBlank":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":null,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"normalizeBool":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"if","condition":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isBlank"},"arguments":[{"__symbolic":"reference","name":"obj"}]},"thenExpression":false,"elseExpression":{"__symbolic":"reference","name":"obj"}}},"isJsObject":{"__symbolic":"function","parameters":["o"],"value":{"__symbolic":"binop","operator":"&&","left":{"__symbolic":"binop","operator":"!==","left":{"__symbolic":"reference","name":"o"},"right":null},"right":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":311,"character":24},"right":"function"},"right":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"error","message":"Expression form not supported","line":311,"character":51},"right":"object"}}}},"isPrimitive":{"__symbolic":"function","parameters":["obj"],"value":{"__symbolic":"pre","operator":"!","operand":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"isJsObject"},"arguments":[{"__symbolic":"reference","name":"obj"}]}}},"hasConstructor":{"__symbolic":"function","parameters":["value","type"],"value":{"__symbolic":"binop","operator":"===","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"value"},"member":"constructor"},"right":{"__symbolic":"reference","name":"type"}}},"escape":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Reference to a local symbol","line":55,"character":4,"context":{"name":"_global"}}},"escapeRegExp":{"__symbolic":"function","parameters":["s"],"value":{"__symbolic":"error","message":"Expression form not supported","line":408,"character":19}}}}

@@ -92,6 +92,6 @@ import { AsyncValidatorFn, ValidatorFn } from './directives/validators';

}): void;
private _setInitialStatus();
private _runValidator();
private _runAsyncValidator(emitEvent);
private _cancelExistingSubscription();
private _disabledChanged(originalStatus);
/**

@@ -230,2 +230,6 @@ * Sets errors on a form control.

/**
* Replace an existing control.
*/
setControl(name: string, control: AbstractControl): void;
/**
* Check whether there is a control with the given name in the group.

@@ -292,2 +296,6 @@ */

/**
* Replace an existing control.
*/
setControl(index: number, control: AbstractControl): void;
/**
* Length of the control array.

@@ -306,2 +314,3 @@ */

getRawValue(): any[];
private _registerControl(control);
}

@@ -76,2 +76,4 @@ /**

this.asyncValidator = asyncValidator;
/** @internal */
this._onCollectionChange = function () { };
this._pristine = true;

@@ -205,2 +207,3 @@ this._touched = false;

this._status = DISABLED;
this._errors = null;
this._forEachChild(function (control) { control.disable({ onlySelf: true }); });

@@ -235,12 +238,11 @@ this._updateValue();

emitEvent = isPresent(emitEvent) ? emitEvent : true;
this._setInitialStatus();
this._updateValue();
this._errors = this._runValidator();
var originalStatus = this._status;
this._status = this._calculateStatus();
if (this._status == VALID || this._status == PENDING) {
this._runAsyncValidator(emitEvent);
if (this.enabled) {
this._errors = this._runValidator();
this._status = this._calculateStatus();
if (this._status === VALID || this._status === PENDING) {
this._runAsyncValidator(emitEvent);
}
}
if (this._disabledChanged(originalStatus)) {
this._updateValue();
}
if (emitEvent) {

@@ -260,2 +262,3 @@ this._valueChanges.emit(this._value);

};
AbstractControl.prototype._setInitialStatus = function () { this._status = this._allControlsDisabled() ? DISABLED : VALID; };
AbstractControl.prototype._runValidator = function () {

@@ -278,6 +281,2 @@ return isPresent(this.validator) ? this.validator(this) : null;

};
AbstractControl.prototype._disabledChanged = function (originalStatus) {
return this._status !== originalStatus &&
(this._status === DISABLED || originalStatus === DISABLED);
};
/**

@@ -354,2 +353,4 @@ * Sets errors on a form control.

AbstractControl.prototype._calculateStatus = function () {
if (this._allControlsDisabled())
return DISABLED;
if (isPresent(this._errors))

@@ -361,4 +362,2 @@ return INVALID;

return INVALID;
if (this._allControlsDisabled())
return DISABLED;
return VALID;

@@ -401,2 +400,4 @@ };

};
/** @internal */
AbstractControl.prototype._registerOnCollectionChange = function (fn) { this._onCollectionChange = fn; };
return AbstractControl;

@@ -499,2 +500,3 @@ }());

this._onDisabledChange = null;
this._onCollectionChange = function () { };
};

@@ -544,3 +546,3 @@ /**

this._initObservables();
this._setParentForControls();
this._setUpControls();
this.updateValueAndValidity({ onlySelf: true, emitEvent: false });

@@ -556,2 +558,3 @@ }

control.setParent(this);
control._registerOnCollectionChange(this._onCollectionChange);
return control;

@@ -565,2 +568,3 @@ };

this.updateValueAndValidity();
this._onCollectionChange();
};

@@ -571,11 +575,25 @@ /**

FormGroup.prototype.removeControl = function (name) {
if (this.controls[name])
this.controls[name]._registerOnCollectionChange(function () { });
StringMapWrapper.delete(this.controls, name);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Replace an existing control.
*/
FormGroup.prototype.setControl = function (name, control) {
if (this.controls[name])
this.controls[name]._registerOnCollectionChange(function () { });
StringMapWrapper.delete(this.controls, name);
if (control)
this.registerControl(name, control);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Check whether there is a control with the given name in the group.
*/
FormGroup.prototype.contains = function (controlName) {
var c = StringMapWrapper.contains(this.controls, controlName);
return c && this.get(controlName).enabled;
return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
};

@@ -632,5 +650,8 @@ FormGroup.prototype.setValue = function (value, _a) {

/** @internal */
FormGroup.prototype._setParentForControls = function () {
FormGroup.prototype._setUpControls = function () {
var _this = this;
this._forEachChild(function (control, name) { control.setParent(_this); });
this._forEachChild(function (control) {
control.setParent(_this);
control._registerOnCollectionChange(_this._onCollectionChange);
});
};

@@ -672,3 +693,3 @@ /** @internal */

}
return !StringMapWrapper.isEmpty(this.controls);
return Object.keys(this.controls).length > 0 || this.disabled;
};

@@ -716,3 +737,3 @@ /** @internal */

this._initObservables();
this._setParentForControls();
this._setUpControls();
this.updateValueAndValidity({ onlySelf: true, emitEvent: false });

@@ -729,4 +750,5 @@ }

this.controls.push(control);
control.setParent(this);
this._registerControl(control);
this.updateValueAndValidity();
this._onCollectionChange();
};

@@ -738,4 +760,5 @@ /**

ListWrapper.insert(this.controls, index, control);
control.setParent(this);
this._registerControl(control);
this.updateValueAndValidity();
this._onCollectionChange();
};

@@ -746,5 +769,22 @@ /**

FormArray.prototype.removeAt = function (index) {
if (this.controls[index])
this.controls[index]._registerOnCollectionChange(function () { });
ListWrapper.removeAt(this.controls, index);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Replace an existing control.
*/
FormArray.prototype.setControl = function (index, control) {
if (this.controls[index])
this.controls[index]._registerOnCollectionChange(function () { });
ListWrapper.removeAt(this.controls, index);
if (control) {
ListWrapper.insert(this.controls, index, control);
this._registerControl(control);
}
this.updateValueAndValidity();
this._onCollectionChange();
};
Object.defineProperty(FormArray.prototype, "length", {

@@ -813,5 +853,5 @@ /**

/** @internal */
FormArray.prototype._setParentForControls = function () {
FormArray.prototype._setUpControls = function () {
var _this = this;
this._forEachChild(function (control) { control.setParent(_this); });
this._forEachChild(function (control) { return _this._registerControl(control); });
};

@@ -833,6 +873,10 @@ /** @internal */

}
return !!this.controls.length;
return this.controls.length > 0 || this.disabled;
};
FormArray.prototype._registerControl = function (control) {
control.setParent(this);
control._registerOnCollectionChange(this._onCollectionChange);
};
return FormArray;
}(AbstractControl));
//# sourceMappingURL=model.js.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc