Skip to content

Instantly share code, notes, and snippets.

@mfp22
Created March 5, 2020 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfp22/2f2c47f630e3c7b6379503236745af4c to your computer and use it in GitHub Desktop.
Save mfp22/2f2c47f630e3c7b6379503236745af4c to your computer and use it in GitHub Desktop.
import {Directive, Input} from '@angular/core';
@Directive({
selector: '[patchFormGroupValues]',
})
export class PatchFormGroupValuesDirective {
@Input() formGroup: any;
@Input()
set patchFormGroupValues(val: any) {
if (!val) return;
this.formGroup.patchValue(val, {emitEvent: false});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment