Last active
September 9, 2019 19:49
-
-
Save cgatian/12530d7ab111b0857374126c3433fafd 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 { Component } from '@angular/core'; | |
import { Observable } from 'rxjs'; | |
import { map } from 'rxjs/operators'; | |
import { UsersGQL } from '../generated/types.graphql-gen'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) | |
export class AppComponent { | |
usersName$: Observable<string[]>; | |
constructor(userNameService: UsersGQL) { | |
this.usersName$ = userNameService.fetch({}).pipe( | |
map(result => result.data.users.data.map(user => user.name)), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment