Working with NG-YouTube-Embed

Just thought to share one new module around YouTube from Angular. This functionality is basically for embedding any Video to your site using angular.

Here'ss the bower command to install the component on your side.

bower install ng-youtube-embed.
 
Once you installed the components successfully, you need to reference the same on index page as in the following snippet:
  1. <script src="bower_components/ng-youtube-embed/ng-youtube-embed.js"></script>  
Then you need to add the same in dependencies as in the following:
  1. angular  
  2.   .module('yeomanApp', [  
  3.     'ngAnimate',  
  4.     'ngAria',  
  5.     'ngCookies',  
  6.     'ngMessages',  
  7.     'ngResource',  
  8.     'ngRoute',  
  9.     'ngSanitize',  
  10.     'ngTouch',  
  11.     'satellizer',  
  12.     'ngYoutubeEmbed'  
  13.   ]) 
Then put the same in controller as in the following snippet.
  1. angular.module('yeomanApp')  
  2.   .controller('MainCtrl'function ($scope) {  
  3.     $scope.link = 'https://youtu.be/aHGmj_fqPLE';  
  4.   });  
Last, but the not the least, template change
  1. <div>  
  2.   <ng-youtube-embed  
  3.     url="link"  
  4.     width="800px"  
  5.     height="500px"  
  6.     autohide="true"  
  7.     theme="light">  
  8.   </ng-youtube-embed>  
  9. </div>  
Then with the above change in place, it will produce the desired result as in the following screenshot.



Thanks for joining me