Created
May 12, 2018 21:03
-
-
Save realtomaszkula/8b87acda58c3bcdfc7b3d59533b4cdb5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
reactiveUsername() { | |
const firstName = this.form.get('firstName'); | |
const lastName = this.form.get('lastName'); | |
const username = this.form.get('username'); | |
const combined$ = combineLatest( | |
firstName.valueChanges, | |
lastName.valueChanges | |
) | |
.pipe(map(([first, last]) => (first && last ? `${first}-${last}` : ''))) | |
.subscribe(value => username.setValue(value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment