Closed isitme closed 6 years ago
import { Component, OnInit } from '@angular/core'; import { FirebaseListObservable } from 'angularfire2/database-deprecated'; import { chatMessegeModel } from '../models/chat-message.model'; import { ChatService } from '../services/chat.service';
@Component({ selector: 'app-feed', templateUrl: './feed.component.html', styleUrls: ['./feed.component.css'] }) export class FeedComponent implements OnInit { feed: FirebaseListObservable<chatMessegeModel[]>;
constructor(private chat: ChatService) { }
ngOnInit() { this.feed = this.chat.getMessages(); }
}
And the template:
*ngFor="let item of main | async"
You're binding to main, which isn't a variable in your class. You probably meant let item of feed | async
main
let item of feed | async
import { Component, OnInit } from '@angular/core'; import { FirebaseListObservable } from 'angularfire2/database-deprecated'; import { chatMessegeModel } from '../models/chat-message.model'; import { ChatService } from '../services/chat.service';
@Component({ selector: 'app-feed', templateUrl: './feed.component.html', styleUrls: ['./feed.component.css'] }) export class FeedComponent implements OnInit { feed: FirebaseListObservable<chatMessegeModel[]>;
constructor(private chat: ChatService) { }
ngOnInit() { this.feed = this.chat.getMessages(); }
}
And the template:
*ngFor="let item of main | async"