Skip to content

Instantly share code, notes, and snippets.

@phenomnomnominal
Last active November 2, 2019 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phenomnomnominal/c860fb76f51ca12a628eca05a7fa5f18 to your computer and use it in GitHub Desktop.
Save phenomnomnominal/c860fb76f51ca12a628eca05a7fa5f18 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
@Component({
template: '<youtube-player videoId="dQw4w9WgXcQ"></youtube-player>',
selector: 'app-video'
})
export class VideoComponent implements OnInit {
ngOnInit() {
const tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
document.body.appendChild(tag);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment