FormArray

Stable Class What it does Tracks the value and validity state of an array of FormControl instances. A FormArray aggregates the values of each child FormControl into an array. It calculates its status by reducing the statuses of its children. For example, if one of the controls in a FormArray is invalid, the entire array becomes invalid. FormArray is one of the three fundamental building blocks used to define forms in Angular, along with FormControl and FormGroup. How to use When instantiat

FormBuilder

Stable Class What it does Creates an AbstractControl from a user-specified configuration. It is essentially syntactic sugar that shortens the new FormGroup(), new FormControl(), and new FormArray() boilerplate that can build up in larger forms. How to use To use, inject FormBuilder into your component class. You can then call its methods directly. import {Component, Inject} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; @Component({ selector: 'e

FormArrayName

Stable Directive What it does Syncs a nested FormArray to a DOM element. How to use This directive is designed to be used with a parent FormGroupDirective (selector: [formGroup]). It accepts the string name of the nested FormArray you want to link, and will look for a FormArray registered with that name in the parent FormGroup instance you passed into 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.

flushMicrotasks()

Experimental Function Class Export export flushMicrotasks() : void Flush any pending microtasks. exported from @angular/core/testing/index defined in @angular/core/testing/fake_async.ts

Form Validation

Validate user's form entries We can improve overall data quality by validating user input for accuracy and completeness. In this cookbook we show how to validate user input in the UI and display useful validation messages using first the template-driven forms and then the reactive forms approach. Learn more about these choices in the Forms chapter. Table of Contents Simple Template-Driven Forms Template-Driven Forms with validation messages in code Reactive Forms with validation in code C

FnArg

Experimental Class Class Overview class FnArg { constructor(value: any, type: Type<any>) value : any type : Type<any> } Class Description Constructor constructor(value: any, type: Type<any>) Class Details value : any type : Type<any> exported from @angular/platform-webworker/index, defined in @angular/platform-webworker/src/web_workers/shared/client_message_broker.ts

Form

Stable Interface Interface Overview interface Form { addControl(dir: NgControl) : void removeControl(dir: NgControl) : void getControl(dir: NgControl) : FormControl addFormGroup(dir: AbstractFormGroupDirective) : void removeFormGroup(dir: AbstractFormGroupDirective) : void getFormGroup(dir: AbstractFormGroupDirective) : FormGroup updateModel(dir: NgControl, value: any) : void } Interface Description An interface that FormGroupDirective and NgForm implement. Only used by the f

fakeAsync()

Experimental Function Class Export export fakeAsync(fn: Function) : args: any[]) => any Wraps a function to be executed in the fakeAsync zone: microtasks are manually executed by calling flushMicrotasks(), timers are synchronous, tick() simulates the asynchronous passage of time. If there are any pending timers at the end of the function, an exception will be thrown. Can be used to wrap inject() calls. Example describe('this test', () => { it('looks async but is synchronous', <any

EventEmitter

Stable Class Class Overview class EventEmitter { constructor(isAsync?: boolean) emit(value?: T) subscribe(generatorOrNext?: any, error?: any, complete?: any) : any } Class Description Use by directives and components to emit custom Events. Examples In the following example, Zippy alternatively emits open and close events when its title gets clicked: @Component({ selector: 'zippy', template: ` <div class="zippy"> <div (click)="toggle()">Toggle</div>

Event

Stable Type-alias What it does Represents a router event. Please see NavigationStart, NavigationEnd, NavigationCancel, NavigationError, RoutesRecognized for more information. Interface Overview interface Event { } Interface Description exported from @angular/router/index, defined in @angular/router/src/router.ts