How to use apollo-angular - 10 common examples

To help you get started, we’ve selected a few apollo-angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github notadd / ng-notadd / src / app / graphql / graphql.service.ts View on Github external
export class MdiIconsGQL extends Apollo.Query<
    MdiIcons.Query,
    MdiIcons.Variables
> {
    document: any = gql`
        query mdiIcons {
            mdiIcons {
                name
            }
        }
    `;
}
@Injectable({
    providedIn: "root"
})
export class WidgetsGQL extends Apollo.Query {
    document: any = gql`
        query widgets {
            widgets {
                type
                chartData {
                    date
                    amount
                }
                increase
                currentAmount
            }
        }
    `;
}

// ====================================================
github kamilkisiela / apollo-angular-services / src / app / generated / graphql.ts View on Github external
export const AuthorFragmentFragment = gql`
  fragment AuthorFragment on Author {
    id
    firstName
    lastName
  }
`;

// ====================================================
// Apollo Services
// ====================================================

@Injectable({
  providedIn: "root"
})
export class AllPostsGQL extends Apollo.Query<
  AllPosts.Query,
  AllPosts.Variables
> {
  document: any = gql`
    query AllPosts {
      posts {
        id
        title
        votes
        author {
          ...AuthorFragment
        }
      }
    }

    ${AuthorFragmentFragment}
github Urigo / WhatsApp-Clone-Client-Angular / src / graphql.ts View on Github external
providedIn: "root"
})
export class RemoveChatGQL extends Apollo.Mutation<
  RemoveChat.Mutation,
  RemoveChat.Variables
> {
  document: any = gql`
    mutation RemoveChat($chatId: ID!) {
      removeChat(chatId: $chatId)
    }
  `;
}
@Injectable({
  providedIn: "root"
})
export class RemoveMessagesGQL extends Apollo.Mutation<
  RemoveMessages.Mutation,
  RemoveMessages.Variables
> {
  document: any = gql`
    mutation RemoveMessages($chatId: ID!, $messageIds: [ID!]) {
      removeMessages(chatId: $chatId, messageIds: $messageIds)
    }
  `;
}

// ====================================================
// END: Apollo Angular template
// ====================================================
github devonfw / my-thai-star / angular / src / app / backend / backend.module.ts View on Github external
import { BookingDataService } from './booking/booking-data-service';
import { OrderDataService } from './order/order-data-service';
import { provideClient } from './graphql-client';
import { ApolloModule } from 'apollo-angular';

// export enum BackendType {
//   IN_MEMORY,
//   REST,
//   GRAPHQL,
// }

@NgModule({
  imports: [
    CommonModule,
    HttpModule,
    ApolloModule.forRoot(provideClient),
  ],
  declarations: [],
  providers: [
    DishesDataService,
    LoginDataService,
    BookingDataService,
    OrderDataService,
  ],
})

export class BackendModule {

  constructor (@Optional() @SkipSelf() parentModule: BackendModule) {
    if (parentModule) {
      throw new Error('BackendModule is already loaded. Import it in the AppModule only');
    }
github bkinsey808 / graphql-fullstack-seed / client / src / app / app-module / app.module.ts View on Github external
import { AppComponent } from './components/app.component';
import { getClient } from './client';
import { UsersComponent } from './components/users/users.component';


@NgModule({
  bootstrap: [ AppComponent ],

  // modules go here
  imports: [
    BrowserModule,
    HttpModule,
    AppRoutingModule,
    MaterialModule,
    BrowserAnimationsModule,
    ApolloModule.withClient(getClient),
  ],

  // services go here
  providers: [ AuthService ],

  // components go here
  declarations: [
    AppComponent,
    UsersComponent
  ],

})

export class AppModule { }
github Urigo / WhatsApp-Clone-GraphQL-Angular-Material / src / app / app.module.ts View on Github external
// rest
import { provideClient } from './apollo';

@NgModule({
  declarations: [
    AppComponent,
    HomePageComponent,
  ],
  imports: [
    // 3rd party modules
    BrowserModule,
    BrowserAnimationsModule,
    ReactiveFormsModule,
    MaterialModule,
    FlexLayoutModule,
    ApolloModule.withClient(provideClient),
    // our modules
    AppRoutingModule,
    AuthModule,
    SharedModule,
    ChatsModule,
    CallsModule,
    ContactsModule,
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
github apollographql / apollo-angular / examples / hello-world / src / app / app.module.ts View on Github external
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { ApolloModule } from 'apollo-angular';

import { AppComponent } from './app.component';
import { getClient } from './client';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    // Define the default ApolloClient
    ApolloModule.withClient(getClient),
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}
github visual-knight / platform-community-edition / apps / visual-knight / src / app / modules / core / types.ts View on Github external
export class DeclineTestSessionGQL extends Apollo.Mutation<
  DeclineTestSessionMutation,
  DeclineTestSessionMutationVariables
> {
  document = DeclineTestSessionDocument;
}
export const SelectedTestSessionDocument = gql`
  query selectedTestSession {
    selectedTestSession @client
  }
`;

@Injectable({
  providedIn: 'root'
})
export class SelectedTestSessionGQL extends Apollo.Query<
  SelectedTestSessionQuery,
  SelectedTestSessionQueryVariables
> {
  document = SelectedTestSessionDocument;
}
export const GetTestNameDocument = gql`
  query getTestName($testId: String!) {
    test(testId: $testId) {
      name
    }
  }
`;

@Injectable({
  providedIn: 'root'
})
github visual-knight / platform-community-edition / apps / visual-knight / src / app / modules / core / types.ts View on Github external
> {
  document = UserlistDocument;
}
export const GetVariationDocument = gql`
  query getVariation($variationId: String!) {
    variation(variationId: $variationId) {
      ...VariationData
    }
  }
  ${VariationDataFragmentDoc}
`;

@Injectable({
  providedIn: 'root'
})
export class GetVariationGQL extends Apollo.Query<
  GetVariationQuery,
  GetVariationQueryVariables
> {
  document = GetVariationDocument;
}
export const AllVariationsDocument = gql`
  query allVariations($testId: String!) {
    variations(testId: $testId) {
      ...VariationData
    }
  }
  ${VariationDataFragmentDoc}
`;

@Injectable({
  providedIn: 'root'

apollo-angular

Use your GraphQL data in your Angular app, with the Apollo Client

MIT
Latest version published 1 month ago

Package Health Score

92 / 100
Full package analysis