Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 { }
// 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 { }
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 {}
import { ApolloModule } from 'apollo-angular';
import { ApolloClient, createNetworkInterface } from 'apollo-client';
export const ApolloModuleInst = ApolloModule.withClient(getClient);
export function getClient() {
return new ApolloClient({
networkInterface: createNetworkInterface({
uri: 'http://localhost:5000',
opts: {
credentials: 'same-origin',
},
}),
dataIdFromObject: o => o['id'],
});
}