Created
March 5, 2020 23:14
-
-
Save mfp22/2f2c47f630e3c7b6379503236745af4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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