* Switched to HttpClient
This commit is contained in:
parent
5e1b402681
commit
0e9f2a448a
4753
package-lock.json
generated
4753
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HttpModule } from "@angular/http";
|
||||
import { GalleryService } from './shared/gallery.service';
|
||||
import { HttpClientModule } from "@angular/common/http";
|
||||
import { GalleryService } from './shared';
|
||||
import { GalleryComponent } from './gallery/gallery.component';
|
||||
import { AlbumComponent } from './album/album.component';
|
||||
import { DisplayImageComponent } from './display-image/display-image.component';
|
||||
@ -12,7 +12,7 @@ import { ThumbnailComponent } from './thumbnail/thumbnail.component';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
HttpModule,
|
||||
HttpClientModule,
|
||||
GalleryRoutingModule,
|
||||
],
|
||||
exports: [
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Http } from "@angular/http";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||
import { Observable } from "rxjs/Observable";
|
||||
import 'rxjs/Rx';
|
||||
@ -13,11 +13,11 @@ export class GalleryService implements Resolve<Array<Album>|false> {
|
||||
public albums: Array<Album> = [];
|
||||
|
||||
constructor(
|
||||
private httpService: Http,
|
||||
private httpService: HttpClient,
|
||||
) {}
|
||||
|
||||
public listGalleries(): Observable<Array<Album>> {
|
||||
return this.httpService.get(environment.apiUrl + '/api/galleries').map(res => res.json());
|
||||
return this.httpService.get<Array<Album>>(environment.apiUrl + '/api/galleries');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user