Getting Started - sibiraj-s/ng-youtube-embed-iframe GitHub Wiki

Install Package

npm

npm install ng-youtube-embed-iframe --save

yarn

yarn add ng-youtube-embed-iframe

use package

Include the modules required for ng-youtube-embed-iframe.

<script src="angular/angular.min.js"></script>
<script src="../ng-youtube.min.js"></script>

add ngYoutube dependency to the module

angular.module('myApp', ['ngYoutube']);

and in your html

<youtube id="myYoutubePlayer" video-id="{{videoId}}"></youtube>

CDN

Minified

//unpkg.com/ng-youtube-embed-iframe@latest/ng-youtube.min.js

Pretty Printed

//unpkg.com/ng-youtube-embed-iframe@latest/ng-youtube.js

options

options like video-id, height, width can be directly provided in the element which is considered as a main priority.

Other options can be provided in player-options

In HTML

<youtube player-options="options" id="myYoutubePlayer"></youtube>

In Controller

$scope.options = {
  videoId: '',
  height: '100%',
  width: '700px',
  playerVars: {} // all parameters supported by youtube-iframe-api
};

Check here for more Youtube Iframe Api Parameters

⚠️ **GitHub.com Fallback** ⚠️