UNPKG

ng-giphy

Version:

An angular module that leverages the [giphy API](https://github.com/Giphy/GiphyAPI) to use it on angular applications

34 lines (29 loc) 658 B
(function () { 'use strict'; angular.module('ng-giphy') .directive('giphyId', findGiphyById); /** * Directive: find gif by id */ function findGiphyById() { return { scope: { id: '=gId', rating: '=' }, controller: findGiphyByIdController, controllerAs: 'vm', bindToController: true, templateUrl: 'imgTemplate.html' }; } findGiphyByIdController.$inject = ['giphy']; /* @ngInject */ function findGiphyByIdController(giphy) { /* jshint validthis: true */ var vm = this; giphy.findUrlById(vm.id).then(function (url) { vm.giphysrc = url; }); } })();