Hello everybody,
my Meteor application using Angular 2 and Typescript seems not to load the server data on the client side: I have followed this tutorial, both with autopublish turned on and of, but each time several tries to display data on client side with different collections failed.
import { Component } from '@angular/core';
import { Mongo } from 'meteor/mongo';
import template from './panel-param-set-selection.component.html';
import { Parties } from '../../../both/collections/parties.collection';
@Component({
selector: 'my-selector',
template
})
export class MyComponent
{
parties: Mongo.Cursor<any>;
constructor() {
this.parties = Parties.find();
alert(this.parties.count());
}
}
The alert returns 0. My collection:
import {Mongo} from 'meteor/mongo';
export const Parties = new Mongo.Collection('parties');
Calling “db.parties.find({});” in mongodb returns 3 rows. I use Angular 2 RC5 and my clients’ main.ts looks like following:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
Maybe anybody can help.