How to use the apollo-angular.ApolloModule.forRoot function in apollo-angular

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 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 lockeyo / Graphcool-Ionic-Instagram-Clone / src / app / app.module.ts View on Github external
@NgModule({
  declarations: [
    MyApp,
    HomePage,
    SearchPage,
    CameraPage,
    FeedPage,
    ProfilePage,
    TabsPage,
    LoginPage,
    RegisterPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    ApolloModule.forRoot(provideClient)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    SearchPage,
    CameraPage,
    FeedPage,
    ProfilePage,
    TabsPage,
    LoginPage,
    RegisterPage
  ],
  providers: [AuthService, {provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {}
github ioxe / graphql-aws-iot-example / src / app / apollo / app-apollo.module.ts View on Github external
getCredentialsFunction,
    debug: true
});

const client: ApolloClient = new ApolloClient({
    dataIdFromObject: (o: any) => o.id,
    networkInterface: wsClient,
    connectToDevTools: true,
});

export function provideClient(): ApolloClient {
    return client;
}

@NgModule({
    imports: [ApolloModule.forRoot(provideClient)],
    exports: [ApolloModule]
})
export class AppApolloModule { }
github Firesphere / silverstripe-headless-ionic / src / app / app.module.ts View on Github external
declarations: [
        MyApp,
        AboutPage,
        ContactPage,
        HomePage,
        TabsPage,
        StaffPage,
        ModalPage,
        RegisterPage,
    ],
    imports: [
        BrowserModule,
        IonicModule.forRoot(MyApp, {
            tabsPlacement: 'bottom'
        }),
        ApolloModule.forRoot(provideClient),
        IonicStorageModule.forRoot()
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        MyApp,
        AboutPage,
        ContactPage,
        HomePage,
        TabsPage,
        StaffPage,
        ModalPage,
        RegisterPage,
    ],
    providers: [
        StatusBar,
        SplashScreen,
github linnovate / mean / src / app / app.module.ts View on Github external
],
  /**
   * Import Angular's modules.
   */
  imports: [
    BrowserAnimationsModule,
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    HttpModule,
    MdToolbarModule,
    MdCardModule,
    MdListModule,
    MdGridListModule,
    RouterModule.forRoot(ROUTES, { useHash: false, preloadingStrategy: PreloadAllModules }),
    ApolloModule.forRoot(client),
  ],
  /**
   * Expose our Services and Providers into Angular's dependency injection.
   */
  providers: [
    ENV_PROVIDERS,
    APP_PROVIDERS
  ]
})
export class AppModule {

  constructor(
    public appRef: ApplicationRef,
    public appState: AppState
  ) { }
github bcarson / community-graph-angular / src / app / app.module.ts View on Github external
declarations: [
    AppComponent,
    DashboardComponent,
    FilterPipe, 
    OrderByPipe, 
    SubstringPipe,
    ResultsListComponent,
    ResultsDetailComponent,
    SearchComponent
  ],
  /*
  *   Imports should contain any modules you've
  *   imported above which are defined elsewhere.
  */
  imports: [
    ApolloModule.forRoot(provideClient),
    BrowserAnimationsModule,
    BrowserModule,
    FlexLayoutModule,
    FormsModule,
    HttpModule,
    MdChipsModule,
    MdIconModule,
    MdInputModule, 
    MdListModule, 
    MdProgressSpinnerModule
  ],
  /*
  *   Providers should contain any services which
  *   you will be injecting into components (either 
  *   declared in this module or imported from elsewhere)
  */
github devonfw / my-thai-star / angular / src / app / backend / dishes / dishes-graph-ql.service.spec.ts View on Github external
beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [DishesGraphQlService],
      imports: [
        ApolloModule.forRoot(provideClient),
      ],
    });
  });
github robzhu / graphql-hackathon / AngularApollo / src / app / app.module.ts View on Github external
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ApolloModule } from 'apollo-angular';

import { AppComponent } from './app.component';
import { PostListComponent } from './post/post-list.component';
import { provideClient } from './client';

@NgModule({
  declarations: [
    AppComponent,
    PostListComponent
  ],
  imports: [
    BrowserModule,
    ApolloModule.forRoot(provideClient)
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
github RocketChat / Rocket.Chat.PWA / src / app / shared / shared.module.ts View on Github external
import { AppComponent } from '../app.component';
import { IonicModule } from 'ionic-angular';
import { ApolloModule } from 'apollo-angular';
import { FormsModule } from '@angular/forms';
import { UnixTimeToStringPipe } from '../../pipes/unix-time-to-string';
import { ServiceWorkerModule } from '@angular/service-worker';
import { PushNotificationsService } from './services/push-notifications.service';
import { LoginPageService } from './services/login-page.service';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    ServiceWorkerModule,
    IonicModule.forRoot(AppComponent, { mode: 'md' }),
    ApolloModule.forRoot(getApolloClient),
  ],
  exports: [
    CommonModule,
    FormsModule,
    IonicModule,
    ApolloModule,
    UnixTimeToStringPipe
  ],
  declarations: [UnixTimeToStringPipe],
  providers: [PushNotificationsService, LoginPageService],
})
export class SharedModule {
}
github prisma-archive / angular-fullstack-graphql / basic / src / app / app.module.ts View on Github external
import { AppComponent } from './app.component'
import { FeedComponent } from './feed.component'
import { NewPostComponent } from './new-post.component'
import { routes } from './routes'
import { provideClient } from './client'

@NgModule({
  declarations: [AppComponent, FeedComponent, NewPostComponent],
  entryComponents: [AppComponent],
  imports: [
    BrowserModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule.forRoot(routes),
    ApolloModule.forRoot(provideClient),
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

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