I was following this tutorial on YouTube, and it's basically a table with the music you like, but the tutorial ends.
It's using Angular2, and everything is working correctly however where the gentleman left it, it's just showing the constructor of the video in the console with this code:
*Playlist.Component.Ts:
export class PlaylistComponent{
onSelect(vid:Video) {
console.log(JSON.stringify(vid)); } }
*Playlist.Component.html:
<table class="table table-hover">
<thead>
<tr>
<td>ID</td>
<td>Title</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr *ngFor="#v of videos" (click)="onSelect(v)">
<td>{{ v.id }}</td>
<td>{{ v.title }}</td>
<td>{{ v.desc }}</td>
</tr>
</tbody>
</table>
*App.Component.Ts:
import {Component} from 'angular2/core';
import {Config} from './config.service';
import {Video} from './video';
import {PlaylistComponent} from './playlist.component';
@Component({
selector: 'my-app',
templateUrl: 'app/ts/app.component.html',
directives: [PlaylistComponent]
})
export class AppComponent {
mainHeading = Config.MAIN_HEADING;
videos:Array<Video>;
constructor() {
this.videos = [
new Video(1, "The 1975 - Somebody Else", "Bimd2nZirT4", "Calm."),
new Video(2, "Killswitch Engage - Holy Diver", "NR7dG_m3MsI", "Hell Yeah!")
]
}
}
*And finally the Video.ts:
export class Video {
id: number;
title: string;
videoCode: string;
desc: string;
constructor(id: number, title: string, videoCode: string, desc: string){
this.id = id;
this.title = title;
this.videoCode = videoCode;
this.desc = desc;
}
}
How would I get it to actually embed the YouTube video in the browser once you click on the table?