当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AngularFireList.snapshotChanges方法代码示例

本文整理汇总了TypeScript中angularfire2/database.AngularFireList.snapshotChanges方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AngularFireList.snapshotChanges方法的具体用法?TypeScript AngularFireList.snapshotChanges怎么用?TypeScript AngularFireList.snapshotChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angularfire2/database.AngularFireList的用法示例。


在下文中一共展示了AngularFireList.snapshotChanges方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 constructor(
   public navCtrl: NavController,
   public alertCtrl: AlertController,
   public database: AngularFireDatabase
 ) {
   this.tasksRef = this.database.list('tasks');
   this.tasks = this.tasksRef.snapshotChanges()
   .map(changes => {
     return changes.map(c => ({ key: c.payload.key, ...c.payload.val() }));
   });
 }
开发者ID:ion-book,项目名称:demo104,代码行数:11,代码来源:home.ts

示例2:

   this.sub = this.activatedRoute.params.subscribe((params:any) => {
     this.id = params['id'];
     this.itemsRef = db.list('/Raves/'+this.id);
     this.itemsRef.snapshotChanges(['child_added'])
       .subscribe(actions => {
         actions.forEach(action => {
           //console.log(action.type, action.key, action.payload.val());
           if (action.key === 'url'){
             this.url = this.domSanitizer.bypassSecurityTrustResourceUrl('https://w.soundcloud.com/player/?url='+action.payload.val()+'&color=000000&auto_play=false&hide_related=false&show_comments=false&show_user=false&show_reposts=false');
             console.log(this.url)
           }
           if (action.key === 'image'){
             this.image = action.payload.val();
             console.log(this.image)
           }
           
         });
       });         
 });
开发者ID:jlooper,项目名称:pocketrave,代码行数:19,代码来源:rave.component.ts

示例3: constructor

 constructor(private router: Router, private readonly db: AngularFireDatabase) {
   this.router = router;
   this.itemsRef = db.list('items');
   this.items = this.itemsRef.snapshotChanges();
 }
开发者ID:fobabett,项目名称:TuneFork,代码行数:5,代码来源:feed.component.ts

示例4: constructor

 constructor(private db : AngularFireDatabase) {
     this.postsRef = db.list('posts');
     this.posts = this.postsRef.snapshotChanges();
 }
开发者ID:tequila1410,项目名称:AngularBlogApp,代码行数:4,代码来源:posts-list.service.ts

示例5: ngOnInit

 ngOnInit(){
     this.events = this.db.list('/Events');
     this.events$ = this.events.snapshotChanges().map(changes => {
         return changes.map(c => ({ key: c.payload.key, ...c.payload.val() }));
     });
 }
开发者ID:jlooper,项目名称:pocketrave,代码行数:6,代码来源:menu.component.ts

示例6: getCommentsByPostId

 /**
  * Get Array of comments
  * @param postId 
  */
 getCommentsByPostId(postId: String): Observable<any[]> {
     this.commentsRef = this.db.list('comments/' + postId);
     this.comments = this.commentsRef.snapshotChanges();
     return this.comments;
 }
开发者ID:tequila1410,项目名称:AngularBlogApp,代码行数:9,代码来源:post-comment.service.ts


注:本文中的angularfire2/database.AngularFireList.snapshotChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。