constructor(private af: AngularFireDatabase) {
   this.items = af.list(`/${TABLE}`).valueChanges();
 }
Exemple #2
0
 getLastMessage(): AngularFireList<any[]>{
   return this.db.list('/messages/last/', ref => ref.orderByChild('time').limitToLast(10) );
 }
 observePosts() {
     return this.af.list( this.category(ALL_CATEGORIES) );
 }
 getCourses(listPath): Observable<any[]> {
   return this.db.list(listPath).valueChanges();
 }
Exemple #5
0
 push( path, data ) {
   return this.db.list('/' + path ).push(data);
 }
Exemple #6
0
 messageIds.map(message => {
   return this.database.object('/messages/'+message.key)
     .first()
 }),
    /**
     * Get post by id
     * @param key 
     */
    getPostById(key: string): Observable<any> {
        this.postRef = this.db.object(`posts/${key}`);
        this.post = this.postRef.valueChanges();

        return this.post;
    }
Exemple #8
0
 readUsers(): Observable<User[]> {
   return this.afDatabase.list('users').map((snapshot: any[]) => (
     snapshot.map(userValues => new User(userValues))
   ));
 }
Exemple #9
0
 readUser(uid: string): Observable<User> {
   return this.afDatabase.object(`users/${uid}`).map((snapshot: any) => (
     new User(snapshot)
   ));
 }
 this.posts.push(postObject).then((item) => {
   this.db.object('/posts/' + item.key + '/entityKey').set(item.key);
 });