This module utilizes the embed.ly functionality and wraps it in angular entities. The module comprises a directive and a service, which supports embed.ly's embedding API and their information extraction API. To embed a video or a photo use the directive, and for information extraction use the service.
Note: The directive only supports embedding of video and photo.
- Add angular-embedly to your project
bower install angular-embedly - Add to your main file (index.html)
<script src="bower_components/angular-embedly/angular-embedly.js"></script>- Set
angular-embedlyas a dependency of your module.
var myApp = angular.module('myApp', ['angular-embedly']);- Set your embed.ly key in myApp.config
myApp.config(function(embedlyServiceProvider){
embedlyServiceProvider.setKey('your key');
});- Add angular-embedly directive to the html
<em-embed urlsearch="{{your.url.goes.here}}"></em-embed>-
In the including scope you can watch
loading_embedlyfor the status of the Embed.ly request. This can be useful for making a loading indicator. -
maxwidthattribute can be used to specify the maximum width of the embed -
schemeattribute to specify the scheme (e.g.http) for the embed, useful when developing for applications that run onfile://, like Cordova apps -
onemptyattribute specifies a function in the controller's scope that should be executed if Embed.ly returns an empty result
<em-embed urlsearch="{{your.url.goes.here}}" maxwidth="number" onempty="yourFunction('Ai, it is empty!')"></em-embed>You can check out some examples here: https://github.com/Urigo/angular-embedly/tree/master/examples