本文整理匯總了TypeScript中angularfire2.FirebaseListObservable.subscribe方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FirebaseListObservable.subscribe方法的具體用法?TypeScript FirebaseListObservable.subscribe怎麽用?TypeScript FirebaseListObservable.subscribe使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angularfire2.FirebaseListObservable
的用法示例。
在下文中一共展示了FirebaseListObservable.subscribe方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: updateTotal
updateTotal() {
this.expenses.subscribe((expenses) => {
this.total = 0;
expenses.forEach((expense) => {
this.total = this.total + (expense.amount ? +expense.amount : 0);
});
});
}
示例2: Observable
return new Observable(observer => {
this._allPosts.subscribe(users => users.forEach(userPosts => {
if (!!userPosts) {
observer.next(Object.values(userPosts));
//observer.complete();
} else {
observer.error("No recipes found");
}
}));
});
示例3: LoadAppUsersList
LoadAppUsersList() {
this.appUsersList = this.af.database.list('/AppUsers');
let listObj: AppUserModel[];
this.appUsersList
.subscribe(snapshots => {
listObj = snapshots;
});
this.teachersList = _.filter(listObj, {Role: 2});
}
示例4: ngOnInit
ngOnInit() {
this.spinnerService.show('Loading Projects');
this.projectsObservable.subscribe(
(p) => {
this.projects = p;
this.spinnerService.hide();
},
(err) => {
this.spinnerService.hide();
}
);
}
示例5: ngOnInit
ngOnInit() {
this.spinnerService.show('Loading Experience');
this.experiencesObservable.subscribe(
(exp) => {
this.experiences = exp;
this.spinnerService.hide();
},
(err) => {
this.spinnerService.hide();
}
);
}
示例6:
this.activeStories.subscribe(queriedItems => {
let index = Math.floor(Math.random() * queriedItems.length);
this.selectedStory = queriedItems[index];
this.storyKey = queriedItems[index].$key;
this.sections = af.database.list('/stories/' + this.storyKey + '/sections');
this.sections.subscribe(sections => {
this.sectionCount = sections.length;
if (this.sectionCount) {
this.prevSection = sections[this.sectionCount - 1];
}
});
});
示例7: Observable
return new Observable(observer => {
this._allRecipes.subscribe(users => users.forEach(userRecipes => {
let allRecipes: Recipe[] = [];
if (!!userRecipes) {
for (let recipeKey in userRecipes) {
let recipe = userRecipes[recipeKey];
if (recipe.ingredients) {
allRecipes.push(recipe);
}
}
observer.next(allRecipes);
//observer.complete();
} else {
observer.error("No recipes found");
}
}));
});
示例8: ngOnInit
ngOnInit() {
this.isInputFocused = false;
this.id = this.route.snapshot.params['id'];
this.tasksObservable = this.taskListService.getTaskList(this.id);
this.listName = this.taskListService.getListName(this.id);
this.editableSubscription =
Observable
.combineLatest(
this.authenticationService.observableUserId,
this.taskListService.getListOwner(this.id))
.subscribe((ids) => { this.isEditable = ids[0] === ids[1]['$value']; });
this.tasksSubscription = this.tasksObservable.subscribe((tasks) => {
this.tasks = tasks;
this.sortTasksByName();
this.setDistances();
});
}
示例9: constructor
constructor(af: AngularFire, private sanitizer: DomSanitizer, private activatedRoute: ActivatedRoute, private router: Router) {
this.sub = this.activatedRoute.params.subscribe((params:any) => {
this.id = params['id'];
})
this.items = af.database.list('/Recipes', {
query: {
orderByChild: 'Approved',
equalTo: true
}
});
this.items.subscribe(queriedItems => {
for (let prop in queriedItems){
this.cleanedImage = this.sanitizer.bypassSecurityTrustUrl(queriedItems[prop].Image);
queriedItems[prop].Image = this.cleanedImage.changingThisBreaksApplicationSecurity;
}
});
}
示例10: Array
this.route.params.subscribe(params => {
this.hash = params['hash'];
this.session = this.af.database.list('/lobbies', {
query: {
orderByChild: 'sessionHash',
equalTo: this.hash
}
});
this.session.subscribe(sess => {
this.players = new Array();
this.sessionKey = sess[0].$key;
for (var key in sess[0].players)
if (sess[0].players.hasOwnProperty(key))
this.players.push(Player.fromJSON(sess[0].players[key]));
if (this.players.length.toString() === sess[0].sessionPlayers)
this.router.navigate(['/voting/' + this.hash]);
});
});