Use http request that calls pixabay api to display images in Angular 6
-1
I want to show a list of images that i get from an api called pixabay, using http request works fine in angular 4, what is the proper way using angular 6 : pagePhoto:any; onSearch(dataForm){ this.http.get("https://pixabay.com/api/?key=10727287-66f9e40c95980a4fc92c26b12&q="+dataForm.motCle+"&per_page=5&page=1") .map(resp=>resp.json()) .subscribe(data=>{ this.pagePhoto=data; }); } I've imported : import {Http} from "@angular/http"; And passed private http:Http in the constructor In my component i show img using ngFor : <div *ngFor="let p of pagePhoto?.hits" class="col-md-3 "> <div class="panel panel-primary cadre"> <div class="p...