如何在home.html中显示此列表?
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { AngularFireDatabase, AngularFireList } from'angularfire2/database';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
school$ : AngularFireList<any[]>;
constructor(public navCtrl: NavController, public db: AngularFireDatabase) {
this.school$ = db.list('/database');
console.log(this.school$);
}
}
我试过这段代码,但它没有用
<ion-list>
<ion-item *ngFor="let data of school$ | async">
<ion-card>
<img src="assets/imgs/ensa.png"/>
<div class="card-title">
<span>{{data.abrev_school}} </span>
</div>
</ion-card>
</ion-item>
</ion-list>