Created
March 5, 2020 23:34
-
-
Save mfp22/12c0d3c56db06d526b0aae289823e347 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'; | |
import {NgControl} from '@angular/forms'; | |
@Directive({ | |
selector: '[setValue]', | |
}) | |
export class SetValueDirective { | |
@Input() | |
set setValue(val: any) { | |
this.ngControl.control.setValue(val); | |
} | |
constructor(private ngControl: NgControl) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment