angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.69k stars 2.19k forks source link

I can't subscribe to angularFireListObservable Please help.. I thought the async pipe will handle that but it isn't #1836

Closed isitme closed 6 years ago

isitme commented 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"

itsthesteve commented 6 years ago

You're binding to main, which isn't a variable in your class. You probably meant let item of feed | async