Skip to content

Instantly share code, notes, and snippets.

@Armenvardanyan95
Created June 15, 2020 10:07
Show Gist options
  • Save Armenvardanyan95/fe5caf16e79e6b51c6d7dfc444b97f80 to your computer and use it in GitHub Desktop.
Save Armenvardanyan95/fe5caf16e79e6b51c6d7dfc444b97f80 to your computer and use it in GitHub Desktop.
@Component({
selector: 'my-component',
template: '<div><input [formControl]="control"/></div>',
})
export class MyComponent implements OnInit {
control = new FormControl('');
ngOnInit() {
fromEvent(document.body, 'click').pipe(
withLatestFrom(this.control.valueChanges),
).subscribe(console.log);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment