zalmoxisus / mobx-remotedev

MobX DevTools extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use with Angular 2

Jonatthu opened this issue · comments

I'm using https://github.com/500tech/ng2-mobx
How can I use this with angular 2?
Some code snippet please?

Unfortunately, I'm not familiar with Angular. I guess you are not allowed to have access to window object directly there. What's the error you get? I guess we should provide a helper like for redux. Maybe someone could step out and implement that here.

The solution it's super simple thanks to this package I'm working now with devtools

Just install the npm package and use it in the store like this in angular 2, that should work!

import remotedev from 'mobx-remotedev/lib/dev';

@Injectable()
@remotedev({ name: 'Todo list', global: true })
export class EBandStore {

You should be able to use it without the @Injectable decorator (as long as there is any kind of decorator Angular can use DI on it)

@adamkleingit for me dependency injection doesn't work without @Injectable. And in tandem with @remotedev neither so. There seems to be really no way how to use @remotedev as decorator on service?