UNPKG

@terminus/ngx-tools

Version:

[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github

25 lines (24 loc) 822 B
import { SimpleChanges } from '@angular/core'; import { AbstractControl } from '@angular/forms'; /** * Helper function to determine if a specific value has changed * * @param changes - The object of changes * @param path - A string with keys defined, separate with '.' * @param control - The formControl * @returns True if the value has changed * * @example * ... * AngularInput: * public myInput; * AngularInput: * public myFormControl; * * ngOnChanges(changes: SimpleChanges) { * // This will update the form control's value whenever the `@Input` value changes: * updateControlOnInputChanges(changes, 'myInput', this.myFormControl)); * } * ... */ export declare function updateControlOnInputChanges(changes: SimpleChanges, path: string, control: AbstractControl | null): boolean;