本文整理汇总了TypeScript中angularfire2/database.AngularFireDatabase.object方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFireDatabase.object方法的具体用法?TypeScript AngularFireDatabase.object怎么用?TypeScript AngularFireDatabase.object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angularfire2/database.AngularFireDatabase
的用法示例。
在下文中一共展示了AngularFireDatabase.object方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: todo
todo(uid: string): AngularFireObject<Todo> {
return this.db.object<Todo>(
`/todos/${this.auth.auth.currentUser.uid}/${uid}`
);
}
示例2:
chats.map( chat=>this.database.object('/messages/'+chat.$key).first()),
示例3: 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;
}
示例4: getDiff
getDiff(id: string): Observable<Array<Diff>> {
const obj: AngularFireObject<Array<Diff>> = this.db.object('diffs/' + id);
return obj.valueChanges();
}
示例5: readUser
readUser(uid: string): Observable<User> {
return this.afDatabase.object(`users/${uid}`).map((snapshot: any) => (
new User(snapshot)
));
}
示例6: getUser
getUser () {
const userId = this.user.uid
const path = `/users/${userId}`
return this.db.object(path)
}
示例7: readStory
readStory(uid: string): Observable<Story> {
return this.afDatabase.object(`stories/${uid}`).map((snapshot: any) => (
new Story(snapshot)
));
}
示例8: getUser
getUser(uidCT:string, uidDQ:string): FirebaseObjectObservable<User> {
return this.af.object(`/${uidCT}/users/${uidDQ}`);
}
示例9: getUserCT
getUserCT(uidCT:string): FirebaseObjectObservable<User> {
return this.af.object(`/${uidCT}/data`);
}
示例10: addUserCT
addUserCT(newUser: UserCT, uidCT:string) {
this.af.object(`/${uidCT}/data`).set(newUser);
}