小编Aru*_*wal的帖子

如何在Angular2中嵌入YouTube视频?

我在YouTube上关注这个教程,它基本上是一个包含你喜欢的音乐的表格,但教程结束了.

它正在使用Angular2,并且一切正常,但是绅士离开它时,它只是在控制台中使用以下代码显示视频的构造函数:

*Playlist.Component.Ts:

export class PlaylistComponent{ 
onSelect(vid:Video) { 
console.log(JSON.stringify(vid)); } }
Run Code Online (Sandbox Code Playgroud)

*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>
Run Code Online (Sandbox Code Playgroud)

*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, …
Run Code Online (Sandbox Code Playgroud)

angular

9
推荐指数
2
解决办法
2万
查看次数

模块'AppModule'导入的意外值'AngularFireDatabase'.请添加@NgModule注释

App.Module.ts

import { AngularFireDatabase } from 'angularfire2/database';

imports: [    
    AngularFireDatabase
]
Run Code Online (Sandbox Code Playgroud)

出于某种原因,当我不需要时,它一直要求我添加一个@NgModule注释.我是Firebase的新手.

我已经尝试将其添加到我的tsconfig.json文件中以查看它是否可以获取angularfire2模块但仍然没有运气:

"paths": {
  "@angular/*": [
    "../node_modules/@angular/*"
  ],
Run Code Online (Sandbox Code Playgroud)

angularfire2 angular

1
推荐指数
1
解决办法
6194
查看次数

标签 统计

angular ×2

angularfire2 ×1