Created
September 14, 2016 21:52
-
-
Save Hitman666/82488792e0f7a640696b1fd088dc4655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
let 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