2016-10-04 40 views
3

在angular2流星指南step3中,我們使用了一個區域方法。 代碼:Angular2-Meteor zone()方法

import { Component } from '@angular/core'; 
import { Observable } from 'rxjs/Observable'; 

import { Parties } from '../../both/collections/parties.collection'; 

...some lines skipped... 
    template 
}) 
export class AppComponent { 
    parties: Observable<any[]>; 

    constructor() { 
    this.parties = Parties.find({}).zone(); 
    } 
} 

究竟是什麼Parties.find({})區()呢?

回答

5

根據你的文章鏈接:

.zone()用於常規Observable連接集合更改使用組件的區視圖的包裝。

欲瞭解更多信息,here is an article是去深入到什麼區域是在角2

從本質上講,Parties.find({}).zone().find()Parties集合中的所有數據和數據連接組件區。由於mongo集合是一個反應性數據源,因此應該允許組件在Mongo集合中更新數據時響應性地更新其數據。

相關問題