Having trouble retrieving data from the Real time Database on firebase. Read and Write permissions are set to public so no authentication is needed.
The npm compilation is successful, indicating that the Angular-CLI code is correct. Following the documentation exactly as provided on GitHub.
When trying to display data from an Object, the front end shows Null. For a List, it displays blank. *ngFor does not work at all.
Is anyone else facing the same issue or can offer assistance?
The code snippet below is a direct copy from the documentation:
My database does not have a label named "Items" like in db.list('items'). I doubt that would be causing the problem, but could that potentially create issues?
import { Component } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-root',
template: `
<ul>
<li *ngFor="let item of items | async">
{{ item | json }}
</li>
</ul>
`,
})
export class AppComponent {
items: Observable<any[]>;
constructor(db: AngularFireDatabase) {
this.items = db.list('items').valueChanges();
}
}
The firebase data structure is as follows:
[
{"THIS" : string , "THAT" : string},
{"THIS" : string , "THAT" : string}
]
This is what the file looks like before uploading.