Closed GIANTCRAB closed 4 years ago
Did you find a solution for this ?
@Tonio-lavanda no, I just switched to another library.
@GIANTCRAB what did you switch to?
@yringler I'm currently using https://github.com/ghidoz/angular2-jsonapi . It doesn't have all the features that this has but it works.
I experimented with https://github.com/ghidoz/angular2-jsonapi but the fact that I can't lazy-load relationship is a huge blocker for me: https://github.com/ghidoz/angular2-jsonapi/issues/103
That's why I came here...
I would rather have AOT working for me than a nice-to-have cache feature that'll definitely improve performance by a lot.
It boils down to what you need.
You could also make a fork that fix this issue but I think that's very time consuming.
@pablorsk Any insight into this issue? I currently shim it by providing all the "Auto-registered" services in app.module and it compiles as expected but this seems to be an anti-pattern.
Hi @iamchrismiller !
The issues with @Autoregister
have been solved. Since this PR there is no need to use @Autoregister
and it will be deprecated in future releases. Please continue reading to understand the issue.
The library needs to register the services in order to create the corresponding instances for the resources received from API. We couldn't find a better approach than providing the resource's Services with the corresponding relatioship's Services.
At the moment, Services are auto registering when instantiated (actually, not when instantiated, but immediately after the call Stack gets empty after instantiation... you can see the code in Service.ts constructor). If you need the service to be registered in instantiation (before the call stack gets empty), you can still register services manually using this.register()
, but this is rarely needed.
I know that it's not very tranparent, I encourage you to create a Fork and help us improve the library. PR's are welcome!
I'm following the guide on README page and I'm experiencing issues with Autoregister whilst on AOT.
Error message
Code
Am I doing something wrong? It works on non-AOT mode.