Skip to content

Instantly share code, notes, and snippets.

Raymon S raymonschouwenaar

Block or report user

Report or block raymonschouwenaar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View block14.
<pre>{{ rockets | json }}</pre>
View block12.
@Injectable({
providedIn: 'root'
})
export class GetRocketsGQL extends Apollo.Query<GetRocketsQuery, GetRocketsQueryVariables> {
document = GetRocketsDocument;
}
View block13.
this.rocketsGQL.watch().valueChanges.subscribe((result) => {
this.rockets = result.data.rockets
})
View block11.
import { Component, OnInit } from '@angular/core'
import { Subject } from 'rxjs'
import { GetRocketsGQL, Rocket } from '../../generated/graphql'
@Component({
selector: 'app-rockets',
templateUrl: './rockets.component.html',
styleUrls: ['./rockets.component.sass'],
})
export class RocketsComponent implements OnInit {
View block10.
import { RocketsComponent } from './rockets/rockets.component'
const routes: Routes = [
{
path: '',
component: RocketsComponent,
},
]
View block9.
<router-outlet></router-outlet>
View block8.
export type GetRocketsQueryVariables = {};
export type GetRocketsQuery = (
{ __typename?: 'Query' }
& { rockets: Maybe<Array<Maybe<(
{ __typename?: 'Rocket' }
& Pick<Rocket, 'name' | 'id' | 'description' | 'company' | 'first_flight' | 'cost_per_launch' | 'country' | 'wikipedia'>
& { diameter: Maybe<(
{ __typename?: 'Distance' }
View block4.npm
npm install -D @graphql-codegen/cli
View block7.
ng generate component rockets -m=app.module.ts
View block5.
overwrite: true
schema: "https://api.spacex.land/graphql"
documents: "src/**/*.graphql"
generates:
src/generated/graphql.ts:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-apollo-angular"
./graphql.schema.json:
You can’t perform that action at this time.