當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript FirebaseListObservable.subscribe方法代碼示例

本文整理匯總了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);
     });
   });
 }
開發者ID:prathamesh7pute,項目名稱:angularattack2016-a-1,代碼行數:8,代碼來源:expenses.component.ts

示例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");
         }
     }));
 });
開發者ID:marcelpetersen,項目名稱:life-guide-hybrid,代碼行數:10,代碼來源:posts.service.ts

示例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});      
  }
開發者ID:vp-mithun,項目名稱:svmandirApp,代碼行數:11,代碼來源:assign-standards.ts

示例4: ngOnInit

 ngOnInit() {
     this.spinnerService.show('Loading Projects');
     this.projectsObservable.subscribe(
         (p) => {
             this.projects = p;
             this.spinnerService.hide();
         },
         (err) => {
             this.spinnerService.hide();
         }
     );
 }
開發者ID:GeorgeA93,項目名稱:grgaln,代碼行數:12,代碼來源:projects-list.component.ts

示例5: ngOnInit

 ngOnInit() {
   this.spinnerService.show('Loading Experience');
   this.experiencesObservable.subscribe(
     (exp) => {
       this.experiences = exp;
       this.spinnerService.hide();
     },
     (err) => {
       this.spinnerService.hide();
     }
   );
 }
開發者ID:GeorgeA93,項目名稱:grgaln,代碼行數:12,代碼來源:experience-list.component.ts

示例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];
                }
            });

        });
開發者ID:aortyl,項目名稱:crispy-writer,代碼行數:14,代碼來源:continue-story.component.ts

示例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");
         }
     }));
 });
開發者ID:marcelpetersen,項目名稱:life-guide-hybrid,代碼行數:17,代碼來源:recipe.service.ts

示例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();
    });
  }
開發者ID:hanaum,項目名稱:choose_to_go,代碼行數:18,代碼來源:taskList.component.ts

示例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;
        }  
    });
  }
開發者ID:jlooper,項目名稱:quicknoms,代碼行數:20,代碼來源:recipes.component.ts

示例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]);
            });
        });
開發者ID:frc1983,項目名稱:AppScrum,代碼行數:21,代碼來源:lobby.component.ts


注:本文中的angularfire2.FirebaseListObservable.subscribe方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。