當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。