* 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 { NgModule } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { HttpModule } from "@angular/http";
|
import { HttpClientModule } from "@angular/common/http";
|
||||||
import { GalleryService } from './shared/gallery.service';
|
import { GalleryService } from './shared';
|
||||||
import { GalleryComponent } from './gallery/gallery.component';
|
import { GalleryComponent } from './gallery/gallery.component';
|
||||||
import { AlbumComponent } from './album/album.component';
|
import { AlbumComponent } from './album/album.component';
|
||||||
import { DisplayImageComponent } from './display-image/display-image.component';
|
import { DisplayImageComponent } from './display-image/display-image.component';
|
||||||
@ -12,7 +12,7 @@ import { ThumbnailComponent } from './thumbnail/thumbnail.component';
|
|||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule,
|
CommonModule,
|
||||||
HttpModule,
|
HttpClientModule,
|
||||||
GalleryRoutingModule,
|
GalleryRoutingModule,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http } from "@angular/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
import { ActivatedRouteSnapshot, Resolve } from "@angular/router";
|
||||||
import { Observable } from "rxjs/Observable";
|
import { Observable } from "rxjs/Observable";
|
||||||
import 'rxjs/Rx';
|
import 'rxjs/Rx';
|
||||||
@ -13,11 +13,11 @@ export class GalleryService implements Resolve<Array<Album>|false> {
|
|||||||
public albums: Array<Album> = [];
|
public albums: Array<Album> = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpService: Http,
|
private httpService: HttpClient,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public listGalleries(): Observable<Array<Album>> {
|
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