Last active
June 13, 2020 09:07
-
-
Save mugan86/0c0226b244646c3863eef0c0eab12287 to your computer and use it in GitHub Desktop.
Componente principal con el iframe para usar el reproductor de Youtube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'my-app', | |
templateUrl: './app.component.html', | |
styleUrls: [ './app.component.css' ] | |
}) | |
export class AppComponent implements OnInit{ | |
ngOnInit() { | |
// Este código carga el reproductor de la API en un iframe de manera asíncrona, siguiendo las instrucciones: | |
// https://developers.google.com/youtube/iframe_api_reference#Getting_Started | |
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