parent
138e0d79cd
commit
1a642231cd
@ -449,7 +449,8 @@ export abstract class AbstractControl {
|
|||||||
* @param opts Configuration options that how marking is applied.
|
* @param opts Configuration options that how marking is applied.
|
||||||
* * `onlySelf`: When true, mark only this control. When false or not supplied,
|
* * `onlySelf`: When true, mark only this control. When false or not supplied,
|
||||||
* marks all direct ancestors, in order to maintain the model.
|
* marks all direct ancestors, in order to maintain the model.
|
||||||
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event. Otherwise,
|
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event.
|
||||||
|
* Otherwise,
|
||||||
* both Observables will emit a status and value event.
|
* both Observables will emit a status and value event.
|
||||||
*/
|
*/
|
||||||
disable(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
disable(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
@ -479,7 +480,8 @@ export abstract class AbstractControl {
|
|||||||
* @param opts Configure options that happen when marked as untouched
|
* @param opts Configure options that happen when marked as untouched
|
||||||
* * `onlySelf`: When true, mark only this control. When false or not supplied,
|
* * `onlySelf`: When true, mark only this control. When false or not supplied,
|
||||||
* marks all direct ancestors, in order to maintain the model.
|
* marks all direct ancestors, in order to maintain the model.
|
||||||
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event. Otherwise,
|
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event.
|
||||||
|
* Otherwise,
|
||||||
* both Observables will emit a status and value event.
|
* both Observables will emit a status and value event.
|
||||||
*/
|
*/
|
||||||
enable(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
enable(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
@ -533,7 +535,8 @@ export abstract class AbstractControl {
|
|||||||
* validity checks are applied.
|
* validity checks are applied.
|
||||||
* * `onlySelf`: When true, only update this control. When false or not supplied,
|
* * `onlySelf`: When true, only update this control. When false or not supplied,
|
||||||
* update all direct ancestors, in order to maintain the model.
|
* update all direct ancestors, in order to maintain the model.
|
||||||
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event. Otherwise,
|
* * `emitEvent`: When false, `statusChanges` and `valueChanges` will not emit an event.
|
||||||
|
* Otherwise,
|
||||||
* both Observables will emit a status and value event.
|
* both Observables will emit a status and value event.
|
||||||
*/
|
*/
|
||||||
updateValueAndValidity(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
updateValueAndValidity(opts: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
@ -642,8 +645,10 @@ export abstract class AbstractControl {
|
|||||||
* Reports error data for a specific error occurring in this control or in another control.
|
* Reports error data for a specific error occurring in this control or in another control.
|
||||||
*
|
*
|
||||||
* @param errorCode The error code for which to retrieve data
|
* @param errorCode The error code for which to retrieve data
|
||||||
* @param path The path to a control to check. If not supplied, checks for the error in this control.
|
* @param path The path to a control to check. If not supplied, checks for the error in this
|
||||||
* @returns The error data if the control with the given path has the given error, otherwise null or undefined.
|
* control.
|
||||||
|
* @returns The error data if the control with the given path has the given error, otherwise null
|
||||||
|
* or undefined.
|
||||||
*/
|
*/
|
||||||
getError(errorCode: string, path?: string[]): any {
|
getError(errorCode: string, path?: string[]): any {
|
||||||
const control = path ? this.get(path) : this;
|
const control = path ? this.get(path) : this;
|
||||||
@ -655,7 +660,8 @@ export abstract class AbstractControl {
|
|||||||
* Reports whether the control with the given path has the error specified.
|
* Reports whether the control with the given path has the error specified.
|
||||||
*
|
*
|
||||||
* @param errorCode The error code for which to retrieve data
|
* @param errorCode The error code for which to retrieve data
|
||||||
* @param path The path to a control to check. If not supplied, checks for the error in this control.
|
* @param path The path to a control to check. If not supplied, checks for the error in this
|
||||||
|
* control.
|
||||||
* @returns True when the control with the given path has the error, otherwise false.
|
* @returns True when the control with the given path has the error, otherwise false.
|
||||||
*/
|
*/
|
||||||
hasError(errorCode: string, path?: string[]): boolean { return !!this.getError(errorCode, path); }
|
hasError(errorCode: string, path?: string[]): boolean { return !!this.getError(errorCode, path); }
|
||||||
@ -909,12 +915,16 @@ export class FormControl extends AbstractControl {
|
|||||||
*
|
*
|
||||||
* @param value The new value for the control.
|
* @param value The new value for the control.
|
||||||
* @param options Configuration options for how the control emits events when the value changes.
|
* @param options Configuration options for how the control emits events when the value changes.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* * `emitModelToViewChange`: When true (the default), each change triggers an `onChange` event to update the view.
|
* * `emitModelToViewChange`: When true (the default), each change triggers an `onChange` event to
|
||||||
* * `emitViewToModelChange`: When true (the default), each change triggers an `ngModelChange` event to update the model.
|
* update the view.
|
||||||
|
* * `emitViewToModelChange`: When true (the default), each change triggers an `ngModelChange`
|
||||||
|
* event to update the model.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
setValue(value: any, options: {
|
setValue(value: any, options: {
|
||||||
@ -966,7 +976,8 @@ export class FormControl extends AbstractControl {
|
|||||||
*
|
*
|
||||||
* @param options Configuration options for emitting events when the control value changes.
|
* @param options Configuration options for emitting events when the control value changes.
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -1247,9 +1258,11 @@ export class FormGroup extends AbstractControl {
|
|||||||
*
|
*
|
||||||
* @param value The new value for the control that matches the structure of the group.
|
* @param value The new value for the control that matches the structure of the group.
|
||||||
* @param options Configuration options for how the control emits events when the value changes.
|
* @param options Configuration options for how the control emits events when the value changes.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
*/
|
*/
|
||||||
setValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
setValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
||||||
@ -1286,9 +1299,11 @@ export class FormGroup extends AbstractControl {
|
|||||||
*
|
*
|
||||||
* @param value The object that matches the structure of the group
|
* @param value The object that matches the structure of the group
|
||||||
* @param options Configure options that happen when the value is patched
|
* @param options Configure options that happen when the value is patched
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*/
|
*/
|
||||||
patchValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
patchValue(value: {[key: string]: any}, options: {onlySelf?: boolean, emitEvent?: boolean} = {}):
|
||||||
void {
|
void {
|
||||||
@ -1318,9 +1333,11 @@ export class FormGroup extends AbstractControl {
|
|||||||
* and options for handling updates and validation.
|
* and options for handling updates and validation.
|
||||||
*
|
*
|
||||||
* @param options Configuration options that happen when the group is reset.
|
* @param options Configuration options that happen when the group is reset.
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*
|
*
|
||||||
* @usageNotes
|
* @usageNotes
|
||||||
*
|
*
|
||||||
@ -1659,9 +1676,11 @@ export class FormArray extends AbstractControl {
|
|||||||
* @param value Array of values for the controls
|
* @param value Array of values for the controls
|
||||||
* @param options Configure options for emitting events when the control value changes
|
* @param options Configure options for emitting events when the control value changes
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*/
|
*/
|
||||||
setValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
setValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
this._checkAllValuesPresent(value);
|
this._checkAllValuesPresent(value);
|
||||||
@ -1696,9 +1715,11 @@ export class FormArray extends AbstractControl {
|
|||||||
* @param value Array of latest values for the controls
|
* @param value Array of latest values for the controls
|
||||||
* @param options Configure options for emitting events when the control value changes
|
* @param options Configure options for emitting events when the control value changes
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*/
|
*/
|
||||||
patchValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
patchValue(value: any[], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
value.forEach((newValue: any, index: number) => {
|
value.forEach((newValue: any, index: number) => {
|
||||||
@ -1748,9 +1769,11 @@ export class FormArray extends AbstractControl {
|
|||||||
* @param value Array of values for the controls
|
* @param value Array of values for the controls
|
||||||
* @param options Configure options for emitting events when the control value changes
|
* @param options Configure options for emitting events when the control value changes
|
||||||
*
|
*
|
||||||
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is false.
|
* * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
|
||||||
|
* false.
|
||||||
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
* * `emitEvent`: When true (the default), each change triggers a valueChanges event.
|
||||||
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity updateValueAndValidity} method.
|
* The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
|
||||||
|
* updateValueAndValidity} method.
|
||||||
*/
|
*/
|
||||||
reset(value: any = [], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
reset(value: any = [], options: {onlySelf?: boolean, emitEvent?: boolean} = {}): void {
|
||||||
this._forEachChild((control: AbstractControl, index: number) => {
|
this._forEachChild((control: AbstractControl, index: number) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user