当前位置: 首页>>代码示例>>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;未经允许,请勿转载。