2muchcoffeecom / ngx-restangular

Restangular for Angular 2 and higher versions
https://2muchcoffee.com/ngxrestangular-app-development
MIT License
781 stars 110 forks source link

Angular 9 Upgrade #181

Closed danielehrhardt closed 4 years ago

danielehrhardt commented 5 years ago

When i run the Following Command i get this error Message

> ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

Warning: Entry point 'ngx-restangular' contains deep imports into 'C:/Projekte//node_modules/core-js/features/object'. This is probably not a problem, but may cause the compilation 
of entry points to be out of order.
jaydiablo commented 4 years ago

This appears to be a duplicate of #179

BehnooshShiva commented 4 years ago

same warning : Warning: Entry point 'ngx-restangular' contains deep imports into 'C:/../node_modules/core-js/features/object'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

And when i run my project ERROR : Cannot instantiate cyclic dependency! Restangular

pouyada commented 4 years ago

Same Warning

Xepe commented 4 years ago

I got the same warning using angular 9.1.4

BehnooshShiva commented 4 years ago

Still no solution ?

pouyada commented 4 years ago

There is no any new release of Restangular yet, so no solution. Anyway I got only a warning and everything works fine.

BehnooshShiva commented 4 years ago

@pouyada I have an error : ERROR : Cannot instantiate cyclic dependency! Restangular Can you tell me which version you use (Angular / Restangular) ?

Thank you

pouyada commented 4 years ago

Here are my dependencies. Please make sure you don't have any circular dependency on your own code.

"dependencies": { "@angular/animations": "^9.1.2", "@angular/cdk": "^9.2.1", "@angular/common": "~9.1.2", "@angular/compiler": "~9.1.2", "@angular/core": "~9.1.2", "@angular/flex-layout": "^9.0.0-beta.29", "@angular/forms": "~9.1.2", "@angular/localize": "^9.1.2", "@angular/material": "^9.2.1", "@angular/material-moment-adapter": "^9.2.1", "@angular/platform-browser": "^9.1.2", "@angular/platform-browser-dynamic": "^9.1.2", "@angular/router": "~9.1.2", "core-js": "^3.6.5", "font-awesome": "^4.7.0", "hammerjs": "^2.0.8", "jwt-decode": "^2.2.0", "material-design-icons": "^3.0.1", "moment": "^2.24.0", "ngx-gallery-9": "^1.0.6", "ngx-restangular": "^5.0.0", "ngx-swiper-wrapper": "^9.0.1", "ngx-webstorage-service": "^4.1.0", "rxjs": "~6.5.5", "rxjs-compat": "^6.5.5", "tslib": "^1.10.0", "zone.js": "~0.10.2" },

BehnooshShiva commented 4 years ago

Hello, I would like to know if the ngx-restangular library is no longer supported ?

I could not update angular on my project since angular 9. Version 10 of Angular is available and i have a error : ` ERROR in node_modules/ngx-restangular/lib/ngx-restangular.module.d.ts:8:97 - error TS2314: Generic type 'ModuleWithProviders' requires 1 type argument(s).

tatic forRoot(providers?: any[], configFunction?: (provider: any, ...arg: any[]) => void): ModuleWithProviders;`

You can please tell me if you no longer support this library so that I can find another solution ?

lweinheimer commented 4 years ago

Angular 10 (typescript 3.9.6) generates the following: ERROR in node_modules/ngx-restangular/lib/ngx-restangular.module.d.ts:8:97 - error TS2314: Generic type 'ModuleWithProviders' requires 1 type argument(s)

rshchpkn commented 4 years ago

Hi! New version was released. Core-js library wasn't removed for now but all other issues should be resolved. Please let us know if ERROR : Cannot instantiate cyclic dependency! Restangular error is still present

pouyada commented 4 years ago

There is no any error however the warning persists.

Entry point 'ngx-restangular' contains deep imports into 'C:/../project-dir/node_modules/core-js/features/object'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

BehnooshShiva commented 4 years ago

I always have this error in Angular 10: ERROR : Cannot instantiate cyclic dependency! Restangular

pouyada commented 4 years ago

I always have this error in Angular 10: ERROR : Cannot instantiate cyclic dependency! Restangular

I think you are using it in a wrong way. please share the piece of code where you are importing and using Restangular.

BehnooshShiva commented 4 years ago

I have been using it for about 2 years. I had no problem before Angular 9.

app.module.ts :

import { RestangularModule } from 'ngx-restangular'; import { RestangularConfigFactory } from '../app/core/restangular.config';

imports: [....,,RestangularModule.forRoot([my services], RestangularConfigFactory),....

RestangularConfigFactory :

export function RestangularConfigFactory(RestangularProvider, mes services) { RestangularProvider.setBaseUrl(...) RestangularProvider.setPlainByDefault(true); RestangularProvider.setDefaultHeaders({ 'Content-Type': 'application/json' }); RestangularProvider.addFullRequestInterceptor(() => {... RestangularProvider.addErrorInterceptor((response) => {...

ex in a services:

import { Restangular } from 'ngx-restangular'; constructor(private restangular: Restangular) {}

getAbout(): Observable { return this.restangular.one(ABOUT_RESOURCE_URL) .withHttpConfig({timeout: timeout}) .get(); }

pouyada commented 4 years ago

@BehnooshShiva make sure none of your services here:

imports: [....,,RestangularModule.forRoot([my services], RestangularConfigFactory),....

have a dependency to restangular.

then in your service: constructor(private restangular: Restangular) {}

try to use restangular as public

BehnooshShiva commented 4 years ago

Make sure none of your services here !

It is a complex project and all the messages, error messages, localstorage and etc managed by services. It is mandatory to use services in RestangularConfigFactory