我開始學習angular2和流星,從http://angular-meteor.com/tutorials/angular2/3-way-data-binding問題從angular-meteor.com
而且在3TH教訓我在控制檯2的錯誤:
refreshingclient/app.ts (18, 11): Generic type 'Array<T>' requires 1 type argument(s).
client/app.ts (20, 19): Cannot find name 'zone'.
當我加了一些文件Mongo從命令行,他們不會出現在頁面上。
和我app.ts文件:
/// <reference path="../typings/angular2-meteor.d.ts" />
import {Component, View, NgFor} from 'angular2/angular2';
import {Parties} from 'collections/parties';
import {bootstrap} from 'angular2-meteor';
@Component({
selector: 'app'
})
@View({
templateUrl: 'client/app.html',
directives: [NgFor]
})
class Socially {
parties: Array;
constructor() {
Tracker.autorun(zone.bind(() => {
this.parties = Parties.find().fetch();
}));
}
}
bootstrap(Socially);
是什麼問題?
好的,它的工作,但只有當我在服務器文件夾中添加文件:** main.ts **和** load_parties.ts **。在沒有任何關於它的教程中,你能解釋我爲什麼會發生這種情況嗎? – kuka11
該教程非常明確。閱讀'在服務器端初始化數據'部分。同時重新閱讀'Declare a Collection'部分,其中描述了流星如何處理名爲「client」和「server」的特殊文件夾。您也可以直接從流星文檔獲取該信息:http://docs.meteor.com/#/full/structuringyourapp –
我明白這個文件夾的用途。但是在教程中(在服務器端初始化數據部分之前)是沒有這些文件的應用程序應該正常工作,但事實並非如此。所以我的問題是爲什麼這個文件必須存在才能正確工作 – kuka11