Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoregister deprecated but still in readme.md #273

Open
DaanVanVugt opened this issue Jun 3, 2020 · 2 comments
Open

Autoregister deprecated but still in readme.md #273

DaanVanVugt opened this issue Jun 3, 2020 · 2 comments

Comments

@DaanVanVugt
Copy link

I am trying to install this in a new Angular 9 app, following the instructions in the README, but I see that @Autoregister() has been deprecated.

What is the new way to register Services?

@DaanVanVugt
Copy link
Author

Interestingly the changelog and decorators/autoregister.js both state since version 3.0.0, but it's already out of 2.1.15.

I'm getting this kind of error:

The relationship relation_alias? (type event) cant be generated because service for this type has not been injected. 2 ngx-jsonapi.js:886


ERROR TypeError: "resource.toObject is not a function"
    toResourceElements ngx-jsonapi.js:1635
    collectionResourcesToElements ngx-jsonapi.js:1620
    collectionResourcesToElements ngx-jsonapi.js:1617
    saveCollection ngx-jsonapi.js:1579
    getAllFromServer ngx-jsonapi.js:3013

@DaanVanVugt
Copy link
Author

Interestingly the changelog and decorators/autoregister.js both state since version 3.0.0, but it's already out of 2.1.15.

I'm getting this kind of error:

The relationship relation_alias? (type event) cant be generated because service for this type has not been injected. 2 ngx-jsonapi.js:886


ERROR TypeError: "resource.toObject is not a function"
    toResourceElements ngx-jsonapi.js:1635
    collectionResourcesToElements ngx-jsonapi.js:1620
    collectionResourcesToElements ngx-jsonapi.js:1617
    saveCollection ngx-jsonapi.js:1579
    getAllFromServer ngx-jsonapi.js:3013

So this error for me was actually caused by the client and server having a different meaning about pluralization of type names. I had the option of changing it server-side to the plural (events) and it works now.

I also added

    constructor() {
      super();
      this.register();
    }

to my EventsService.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant