I need to showcase some data stored in firebase on my HTML page with a specific database structure. I want to present the years as a clickable array and upon selecting a year, retrieve the corresponding records in my code.
Although I managed to display a static array of years like ["1999", "1994"], I encountered difficulties when attempting to fetch and display the database records.
<div class="list-group" *ngFor="let year of years">
<a routerLink="records" routerLinkActive="active">
<mdb-icon fas icon="table" class="mr-3"></mdb-icon>{{year}}</a>
</div>
export class NavigationComponent implements OnInit {
@ViewChild('sidenav', {static: true}) sidenav: ElementRef;
clicked: boolean;
resizedImage: Blob;
years:AngularFireList<any[]>;
constructor(af:AngularFireDatabase,
private router: Router) {
this.clicked = this.clicked === undefined ? false : true;
this.years=af.list('/years/Akhilesh');
}
Here is the TypeScript code^