@angular/common/http#HttpClient TypeScript Examples

The following examples show how to use @angular/common/http#HttpClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: configuration.service.ts    From 1hop with MIT License 6 votes vote down vote up
constructor(
        private http: HttpClient
    ) {

        setInterval(() => {

            try {

                this.setGasPrices();
            } catch (e) {

            }
        }, 30000);

        this.setGasPrices();
    }
Example #2
Source File: configuration.service.ts    From 1x.ag with MIT License 6 votes vote down vote up
constructor(
        private http: HttpClient
    ) {

        setInterval(() => {

            try {

                this.setGasPrices();
            } catch (e) {

            }
        }, 30000);

        this.setGasPrices();
    }
Example #3
Source File: gas-price.api.service.ts    From gnosis.1inch.exchange with MIT License 6 votes vote down vote up
constructor(private http: HttpClient) {
    timer(0, 30000).pipe(
      mergeMap(() => this.getGasPrice()),
      tap((gasPrice: GasPrice) => {

        const fast = formatGasPrice(gasPrice.fast);
        const instant = formatGasPrice(gasPrice.instant);
        const standard = formatGasPrice(gasPrice.standard);

        this.gasPrice.next({
          fast: ethers.utils.bigNumberify(Math.trunc(fast)),
          standard: ethers.utils.bigNumberify(Math.trunc(standard)),
          instant: ethers.utils.bigNumberify(Math.trunc(instant))
        });
      })
    ).subscribe();
  }
Example #4
Source File: app.module.ts    From TypeFast with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
    TyperComponent,
    TimePipe,
    PreferencesComponent,
    PopperDirective,
    IncorrectWordComponent,
    AboutComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    MarkdownModule.forRoot({ loader: HttpClient }),
  ],
  providers: [WordService, PreferencesService, ThemeService, LanguageService],
  bootstrap: [AppComponent],
})
export class AppModule {
  constructor(private themeService: ThemeService) {}
}
Example #5
Source File: translation.module.ts    From xBull-Wallet with GNU Affero General Public License v3.0 6 votes vote down vote up
static forRoot(): ModuleWithProviders<TranslateModule> {
    return TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient],
      }
    });
  }
Example #6
Source File: public-blockchain-adapter.service.ts    From rubic-app with GNU General Public License v3.0 6 votes vote down vote up
constructor(
    private readonly walletConnectorService: WalletConnectorService,
    private readonly httpClient: HttpClient
  ) {
    this.setEthLikeWeb3();
    this.setSolanaWeb3();
    this.setNearWeb3();

    this.checkAllRpcProviders();
  }
Example #7
Source File: layout.module.ts    From dbm with Apache License 2.0 6 votes vote down vote up
@NgModule({
  declarations: [
    LayoutComponent,
    HeaderComponent
  ],
  imports: [
    LayoutRouting,
    FormsModule,
    CommonModule,
    NgZorroAntdModule,
    MarkdownModule.forRoot(),
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: httpLoaderFactory,
        deps: [HttpClient]
      }
    })
  ],
  providers: [
    BasicService,
    DatasourceService,
    HttpService,
    SshService,
    PrestoService,
    FactoryService
  ]
})
export class LayoutModule {
}
Example #8
Source File: about.module.ts    From RcloneNg with MIT License 6 votes vote down vote up
@NgModule({
	declarations: [AboutComponent],
	imports: [
		CommonModule,
		AboutRoutingModule,
		HttpClientModule,
		MarkdownModule.forRoot({ loader: HttpClient }),
		NbCardModule,
	],
})
export class AboutModule {}
Example #9
Source File: app.module.ts    From mylog14 with GNU General Public License v3.0 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (LanguageLoader),
        deps: [HttpClient],
      }
    }),
    CoreModule,
    SharedModule,
    LottieModule.forRoot({ player: playerFactory }),
    ReactiveFormsModule,
    FormlyModule.forRoot(),
    FormlyIonicModule
  ],
  providers: [
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #10
Source File: spotify-auth.component.ts    From ng-spotify-importer with GNU General Public License v3.0 6 votes vote down vote up
constructor(private activatedRoute: ActivatedRoute, private http: HttpClient, private spotifyService: SpotifyService) {
    if (!sessionStorage.codeVerifier) {
      sessionStorage.codeVerifier = this.spotifyService.generateCodeVerifier();
    }

    this.codeVerifier = sessionStorage.codeVerifier;
    this.codeChallenge = this.spotifyService.generateCodeChallenge(this.codeVerifier);
    this.authUrl = this.generateAuthUrl();
  }
Example #11
Source File: app.module.ts    From msfs-community-downloader with GNU Affero General Public License v3.0 6 votes vote down vote up
@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        FormsModule,
        HttpClientModule,
        CoreModule,
        SharedModule,
        HomeModule,
        ListEditorModule,
        ImportModule,
        SettingsModule,
        AppRoutingModule,
        FontAwesomeModule,
        TranslateModule.forRoot({
            loader: {
                provide: TranslateLoader,
                useFactory: HttpLoaderFactory,
                deps: [HttpClient]
            }
        })
    ],
    providers: [],
    bootstrap: [AppComponent]
})
export class AppModule {
}
Example #12
Source File: sessions.component.ts    From leapp with Mozilla Public License 2.0 6 votes vote down vote up
constructor(
    private ref: ChangeDetectorRef,
    private router: Router,
    private route: ActivatedRoute,
    private httpClient: HttpClient,
    private modalService: BsModalService,
    private appService: AppService,
    private leappCoreService: AppProviderService
  ) {
    this.behaviouralSubjectService = this.leappCoreService.behaviouralSubjectService;
    this.awsCoreService = this.leappCoreService.awsCoreService;

    this.columnSettings = Array.from(Array(5)).map((): ArrowSettings => ({ activeArrow: false, orderStyle: false }));
    const subscription = globalHasFilter.subscribe((value) => {
      this.eGlobalFilterExtended = value;
    });
    const subscription2 = globalFilteredSessions.subscribe((value) => {
      this.eGlobalFilteredSessions = value;
    });
    const subscription3 = compactMode.subscribe((value) => {
      this.eCompactMode = value;
    });
    const subscription4 = globalFilterGroup.subscribe((value) => {
      this.eGlobalFilterGroup = value;
    });
    const subscription5 = globalColumns.subscribe((value) => {
      this.eGlobalColumns = value;
    });

    this.subscriptions.push(subscription);
    this.subscriptions.push(subscription2);
    this.subscriptions.push(subscription3);
    this.subscriptions.push(subscription4);
    this.subscriptions.push(subscription5);

    globalOrderingFilter.next(JSON.parse(JSON.stringify(this.behaviouralSubjectService.sessions)));
  }
Example #13
Source File: attribution.service.ts    From barista with Apache License 2.0 6 votes vote down vote up
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
        if (basePath) {
            this.basePath = basePath;
        }
        if (configuration) {
            this.configuration = configuration;
            this.basePath = basePath || configuration.basePath || this.basePath;
        }
    }
Example #14
Source File: app.module.ts    From OrchardSkills.OrchardCore.Headless with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    AppComponent,
    NavbarComponent,
    BlogContentComponent,
    BlogComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    RouterModule,
    GraphQLModule,
    HttpClientModule,
    NgxPaginationModule,
    HttpClientModule,
    MarkdownModule.forRoot({
      loader: HttpClient,
      markedOptions: {
        provide: MarkedOptions,
        useValue: {
          gfm: true,
          tables: true,
          breaks: true,
          pedantic: false,
          sanitize: true,
          smartLists: true,
          smartypants: true,
        }
      }
    }),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Example #15
Source File: user.service.ts    From Angular-Cookbook with MIT License 6 votes vote down vote up
constructor(private http: HttpClient) {
    if (this.worker === null) {
      return;
    }
    this.worker.onmessage = ({ data: { uniqueId, email } }) => {
      console.log('received message from worker', uniqueId, email);
      const user = this.usersCache.find((user) => user.email === email);
      localStorage.setItem(
        `ng_user__${user.email}`,
        JSON.stringify({
          ...user,
          uniqueId,
        })
      );
    };
  }
Example #16
Source File: app.module.ts    From ionic-doctor-online with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [
    MyApp
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(MyApp),
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    }),
    SuperTabsModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    ShareServiceProvider,
    Storage
  ]
})
export class AppModule {}
Example #17
Source File: app.module.ts    From VIR with MIT License 6 votes vote down vote up
@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    HttpClientModule,
    CoreModule,
    SharedModule,
    HomeModule,
    DetailModule,
    AppRoutingModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient],
      },
    }),
  ],
  providers: [MetadataStore, DataStore, DataAnalyzer, FsUtil, Clock],
  bootstrap: [AppComponent],
})
export class AppModule {
}
Example #18
Source File: 1inch.api.service.ts    From gnosis.1inch.exchange with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) {
  }
Example #19
Source File: computervision.service.ts    From Angular-Computer-Vision-Azure-Cognitive-Services with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) {
    this.baseURL = '/api/OCR';
  }
Example #20
Source File: document-viewer.component.ts    From transformers-for-lawyers with Apache License 2.0 5 votes vote down vote up
constructor(private http: HttpClient) { }
Example #21
Source File: app.component.ts    From angular-custom-material-paginator with MIT License 5 votes vote down vote up
constructor(private httpClient: HttpClient) {
      this.getPageDetails();
    }
Example #22
Source File: slider.service.ts    From DocumentationWebPage with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) {
 }
Example #23
Source File: app.component.ts    From Smersh with MIT License 5 votes vote down vote up
constructor(
    private http: HttpClient,
    private router: Router,
    private dialog: MatDialog,
    private themeService: ThemeService
  ) {}
Example #24
Source File: image-api.service.ts    From frontend-framework-showdown-2020 with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) { }
Example #25
Source File: alerts-labels.service.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(
    private readonly alertsLabelsStore: AlertsLabelsStore,
    private readonly http: HttpClient,
  ) { }
Example #26
Source File: app.loaders.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
export function httpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', `.json?_t=${new Date().getTime()}`);
}
Example #27
Source File: product.service.ts    From Angular-ActionStreams with MIT License 5 votes vote down vote up
constructor(private http: HttpClient) { }