mobxjs / mobx-angular

The MobX connector for Angular.
MIT License
483 stars 59 forks source link

Please help: *mobxAutorun makes the whole component not being rendered #42

Closed davidpodhola closed 7 years ago

davidpodhola commented 7 years ago

I must be missing something obvious and I know I use this issue selfishly to get help.

If I add *mobxAutorun on the top of tags.component.html, the whole component is not rendered. If I remove it, it is rendered on the bottom of the page, but the the code reflecting to the commonStore.isLoadingTags is not processed correctly.

Thanks for your suggestions!

adamkleingit commented 7 years ago

Hi, you need to import MobxAngularModule in SharedModule, not AppModule, and then export it as well so it's available throughout the app:

@NgModule({
  imports: [
    ...
    MobxAngularModule
  ],
  ...
  exports: [
    ...
    MobxAngularModule
  ]
})
export class SharedModule {}
davidpodhola commented 7 years ago

Perfect, thanks a lot!