Angular 2 Meteor Dependency Injection


I’m new to both Meteor and Angular but am evaluating both with a view to porting an existing application. I’ve followed with interest the excellent Angular 2 tutorial.

A big attraction for me of Angular 2 is its emphasis on dependency injection using services, nice encapsulated components etc. Meteor OTOH seems to offer a very good publish/subscribe infrastructure along with all the advatages of node.js.

However the use of MeteorComponent in the tutorial seems to work against Angular 2’s dependency injection approach, seemingly closely coupling each component with the details of Meteor’s publish/subscribe mechanism.

I’d like to see an implementation (or maybe try to implement one myself) of a Meteor/Angular2 hybrid which uses an injected angular service to separate the details of the Publish/Subscribe layer from the component implementation.

Does anyone have any examples of such an approach or arguments/suggestions for or against trying it?


Is it already good time to start new app with Angulas2 (beta)?

I’ve raised an issue on this subject here:


Hi @sirockin, Dependency Injection is working perfect. When you have Service, just use it directly like in normal Angular 2 apps.


For some reason, Dependency injection does not quite work for me, to work around that, I need to hand-code the dependencies instead of using the decorators. For example

@Injectable() //this does not work
export class Car {
    static get parameters() {
        return [[Engine, Wheel]]; // Have to hand code this static parameters as a workaround.

    constructor( public engine:Engine, public wheel:Wheel ) {


Which Angular 2 and Meteor version are you using?

Have you imported Injectable?

import { Injectable } from ‘@angular/core’;


Yes, Injectable is declared on both the Car class and Engine class in the sample above, and the Injectable is imported from @angular/core

I use Angular 2.0.0-rc1 and Meteor, and I also remove and readd all the meteor packages just to make sure they stay up to date as well.

The runtime error I have got is Uncaught Cannot resolve all parameters for 'Car'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Car' is decorated with Injectable.


@tangentlin aybe create an issue on github with a reproduction (small demo)?