I have some records in firebase which I want to display on my HTML page. I have attached the structure of the database. Now, I want to display the years in form an array (which are clickable). On selecting a particular year, I want the respective records to be retrieved in my code.
I tried retrieving the years,but was unable to display them on the page. I tried a static array as years=["1999","1994"] which worked. Only the data from database is not being retrieved and displayed.
<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;
//years = ['1999', '2004', '2019'];
clicked: boolean;
resizedImage: Blob;
years:AngularFireList<any[]>;
// TODO: Need to fix the click effect of years
constructor(af:AngularFireDatabase,
private router: Router,
//private userService: UserService
//private ng2ImgMax: Ng2ImgMaxService
) {
this.clicked = this.clicked === undefined ? false : true;
this.years=af.list('/years/Akhilesh');}
That's the typescript code^
console.log(this.years)
return? – Peter Haddad