本文整理汇总了TypeScript中angularfire2/database.AngularFireDatabase类的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFireDatabase类的具体用法?TypeScript AngularFireDatabase怎么用?TypeScript AngularFireDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AngularFireDatabase类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private af: AngularFireDatabase) {
this.items = af.list(`/${TABLE}`).valueChanges();
}
示例2: getLastMessage
getLastMessage(): AngularFireList<any[]>{
return this.db.list('/messages/last/', ref => ref.orderByChild('time').limitToLast(10) );
}
示例3: observePosts
observePosts() {
return this.af.list( this.category(ALL_CATEGORIES) );
}
示例4: getCourses
getCourses(listPath): Observable<any[]> {
return this.db.list(listPath).valueChanges();
}
示例5: push
push( path, data ) {
return this.db.list('/' + path ).push(data);
}
示例6:
messageIds.map(message => {
return this.database.object('/messages/'+message.key)
.first()
}),
示例7: getPostById
/**
* 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;
}
示例8: readUsers
readUsers(): Observable<User[]> {
return this.afDatabase.list('users').map((snapshot: any[]) => (
snapshot.map(userValues => new User(userValues))
));
}
示例9: User
readUser(uid: string): Observable<User> {
return this.afDatabase.object(`users/${uid}`).map((snapshot: any) => (
new User(snapshot)
));
}
示例10:
this.posts.push(postObject).then((item) => {
this.db.object('/posts/' + item.key + '/entityKey').set(item.key);
});