mobx-angular: MobX cannot be used with AoT
This is kind of a deal breaker for using MobX with Angular. It turns out that MobX’s decorators cause Angular’s AoT to fail:
ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 77:13 in the original .ts file), resolving symbol action
Maybe this should be added to the README.md or maybe there is some other way to fix the problem that I am unaware of.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (3 by maintainers)
It works but you have to use the decorators provided by mobx-angular instead of the ones from MobX.
On May 7, 2017 01:13, “Yago López” notifications@github.com wrote:
For reference, I managed to “kind of” get it working by creating a separate file and creating functions that forward to MobX. It is incredibly ugly and should not be necessary but as with most things in Angular, what shouldn’t be necessary is necessary:
So Angular doesn’t analyze it because it comes from a node_module? Did you open an issue to Angular? Can you paste a link to it so we +1 it?
On Mon, Feb 6, 2017 at 12:32 PM, Hugo Campos notifications@github.com wrote:
– Adam Klein CTO & Co-Founder Tel. +972-52-747-5633 blog.500tech.com http://blog.500tech.com meetup.com/angularjs-il