Last active
June 4, 2020 02:38
-
-
Save sanchezcarlosjr/845e9ac4c38b955aa84bcccfe3102b4e to your computer and use it in GitHub Desktop.
Getting data from Firestore and Fetching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<div *ngFor="let article of articles | async"> | |
<h1>{{article.title}}</h1> | |
<p><{{article.content}}/p> | |
<p>{{article.created_at}}</p> | |
</div> | |
</div> | |
<-- Whatever component --> | |
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)"> | |
<ion-infinite-scroll-content loadingSpinner="crescent" loadingText="Loading..."> | |
</ion-infinite-scroll-content> | |
</ion-infinite-scroll> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class PortfolioComponent implements OnInit, OnDestroy { | |
@Select(RacesState.articles) articles: Observable<Article[]>; | |
constructor(private store: Store, private news: NewsFirestore) {} | |
ngOnInit(): void { | |
this.store.dispatch(new Fetch()); | |
} | |
ngOnDestroy(): void { | |
this.store.dispatch(new DisconnectStream(new Fetch())); | |
} | |
loadData(event: any): void { | |
this.news.more(() => event.target.complete()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment