ng-giphy
An angular module that leverages the giphy API to use it on angular applications
Usage:
-
Install
ng-giphy
from bower, npm or import script manually$ bower install ng-giphy --save $ npm install ng-giphy --save
-
Include the supplied JS file. Skip if you use Commonjs modules
<!-- Bower --><!-- npm --> -
Add ng-giphy dependency to your app
angularIf you use Commonjs modules:
var ngGiphy = ;angular
Configuration
The Giphy API is open to the public. They have instituted a public beta key system to let anyone try it out. The API key is required for all endpoints. In this module, for test purposes we use the public beta key: "dc6zaTOxFJmzC”. Please use this key while you develop your application and experiment with your integrations. To request a production key or get more information please visit this link.
If you are using a production key use the ng-giphy config provider to set it up:
angular ; runConfig$inject = 'giphyConfigProvider'; { // set your private key here giphyConfigProvider;}
Service
-
Add
giphy
dependency injection into your controller, service etc.MyController$inject = 'giphy';{// use giphy service} -
Use one of the methods described below
Method Arguments Returns find tags, limit, offset, rating Gif Collection findUrl tags, limit, offset, rating Gif url's Collection findById id Gif findUrlById id Gif url findRandom tags Gif findRandomUrl tags Gif url findTrending limit, offset, rating Gif Collection findTrendingUrl limit, offset Gif url's Collection
Usage example:
// tags: cat, funny// limit: 3// offset: 1giphy; // tags: cat// limit: 25 (Default)// offset: 0 (Default)giphy;
Directives
Name | Description | Attributes |
---|---|---|
giphy-find | Gif by tag/s | giphy-tag |
giphy-find-id | Gif by id | giphy-id |
giphy-rand | Random Gif by tag/s | giphy-tag |
Usage example