Skip to content

Instantly share code, notes, and snippets.

@Hitman666
Created September 14, 2016 21:43
Show Gist options
  • Save Hitman666/bcc556fa5abcee446cc0c3a69afb6aac to your computer and use it in GitHub Desktop.
Save Hitman666/bcc556fa5abcee446cc0c3a69afb6aac to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { Http, Response } from '@angular/http';
@Component({
moduleId: module.id,
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css']
})
export class AppComponent {
title = 'Welcome to GiphySearch';
link = 'http://api.giphy.com/v1/gifs/search?api_key=dc6zaTOxFJmzC&q=';
http: Http;
constructor(http: Http) {
this.http = http;
}
performSearch(searchTerm: string):string {
var apiLink = this.link + searchTerm;
this.http.request(apiLink).subscribe((res: Response) => {
console.log(res.json());
});
return searchTerm;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment