【发布时间】:2017-12-13 17:06:46
【问题描述】:
今天我遇到了服务器-客户端框架 Meteor.js,我从他们的初学者教程和 Angular 2.0 开始,我目前已经卡在第三步 "Meteor tutorial"
所以基本上我只需要将它们连接到数据库并测试 Meteor 的功能,问题是即使我能够通过命令行连接到 Meteor 的数据库,在那里插入一个对象,数据也无法获取应用程序本身。 我正在学习教程,
这就是我的 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<Object>;
constructor () {
Tracker.autorun(zone.bind(() => {
this.parties = Parties.find().fetch();
}));
}
}
bootstrap(Socially);
party.ts
/// <reference path="../typings/angular2-meteor.d.ts" />
export var Parties = new Mongo.Collection('parties');
和app.html
Do you even work ;c
<ul>
<li *ng-for="#party of parties">
{{party.name}}
<p>{{party.description}}</p>
</li>
</ul>
我也读过一些关于 Meteor 的本地数据库,如果我尝试像这样将对象添加到本地存储中
Parties._collection.insert({name:"test", description: "test desc"});
数据显示正确,但即使我在服务器数据库中有数据(通过命令行添加)它也不会显示...
【问题讨论】:
标签: javascript angular meteor