Skip to content

Instantly share code, notes, and snippets.

View chsami's full-sized avatar

chsami chsami

View GitHub Profile
loadChildren: './lazy/lazy.module#LazyModule', // use this syntax for non-ivy or Angular 7 and below
loadChildren : () => import('./lazy/lazy.module').then(m => m.LazyModule), // new dynamic import method
import { Version } from '../package.json';
<div [@enterAnimation] (@enterAnimation.done)="animationEndCallback($event)">
</div>
./src/introspection-result.ts:
plugins:
- fragment-matcher
import introspectionResult from '../introspection-result';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData: introspectionResult
});
const cache = new InMemoryCache({
fragmentMatcher
{
provide: APOLLO_OPTIONS,
useFactory(httpLink: HttpLink) {
return {
cache, // InMemoryCache with custom fragment matcher
link: httpLink.create({
uri: environment.targetsugraphqlurl
})
};
},
constructor(apollo: Apollo, httpLink: HttpLink, oAuthService: OAuthService) {
apollo.create({
link: httpLink.create({
uri: environment.graphqlurl,
headers: new HttpHeaders({
authorization: oAuthService.getAccessToken()
}),
withCredentials: true
}),
cache
import {Injectable} from '@angular/core';
import {ApolloLink, Observable} from 'apollo-link';
import {Apollo} from 'apollo-angular';
import {HttpLink} from 'apollo-angular-link-http';
import {withClientState} from 'apollo-link-state';
import {onError} from 'apollo-link-error';
import {InMemoryCache} from 'apollo-cache-inmemory';
import {PresetConfig} from './types';
_fixture.Customizations.Add(
new TypeRelay(
typeof(Animal),
typeof(Dog)));
_fixture.Customizations.Add(
new TypeRelay(
typeof(Animal),
typeof(Cat)));