localize-router icon indicating copy to clipboard operation
localize-router copied to clipboard

LocalizeRouterModule.forRoot returns a ModuleWithProviders type without a generic type argument

Open chiqui3d opened this issue 4 years ago • 20 comments

I'm submitting a ...

[x] bug report => Search github for a similar issue or PR before submitting

Full Error

  ERROR in node_modules/localize-router/src/localize-router.module.d.ts:33:68 - error NG6005: LocalizeRouterModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument
to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.
    
    33     static forRoot(routes: Routes, config?: LocalizeRouterConfig): ModuleWithProviders;
                                                                          ~~~~~~~~~~~~~~~~~~~
    src/app/app-routing.module.ts:40:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
    
    40 export class AppRoutingModule {}

🌍 Your Environment

Angular Version:


~9.0.0-rc.8

Localize Router Version:


"localize-router": "^2.0.0-RC.3",
"localize-router-http-loader": "^1.0.2",

app-routing.module.ts


import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import {HomeComponent} from './page/home/home.component';
import {ContactComponent} from './page/contact/contact.component';
import {TranslateService} from '@ngx-translate/core';
import {HttpClient} from '@angular/common/http';
import { Location } from '@angular/common';
import {LocalizeParser, LocalizeRouterModule, LocalizeRouterSettings} from 'localize-router';
import {LocalizeRouterHttpLoader} from 'localize-router-http-loader';

export function HttpLoaderFactory(translate: TranslateService, location: Location, settings: LocalizeRouterSettings, http: HttpClient) {
  return new LocalizeRouterHttpLoader(translate, location, settings, http);
}

const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    component: HomeComponent
  },
  {
    path: 'contact',
    component: ContactComponent
  }
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes),
    LocalizeRouterModule.forRoot(routes, {
      parser: {
        provide: LocalizeParser,
        useFactory: HttpLoaderFactory,
        deps: [TranslateService, Location, LocalizeRouterSettings, HttpClient]
      }
    })
  ],
  exports: [ RouterModule, LocalizeRouterModule ]
})
export class AppRoutingModule {}


chiqui3d avatar Jan 26 '20 15:01 chiqui3d

I have the same problem

Bozonych avatar Feb 16 '20 10:02 Bozonych

Same here

materazu avatar Feb 28 '20 09:02 materazu

Same here

ghost avatar Mar 02 '20 22:03 ghost

Same here

skyquartam avatar Mar 07 '20 15:03 skyquartam

Can someone fix it for a compatibility with INY and Angular 9?

Here is a PR about that https://github.com/Greentube/localize-router/pull/174

Maybe it needed to fix the yaml file for CI and replace node v8 with node v12 to make this PR successful?

ottodranik avatar Mar 12 '20 11:03 ottodranik

Same here

marcgeurts avatar Mar 17 '20 14:03 marcgeurts

same here

sleepychaman avatar Mar 22 '20 16:03 sleepychaman

same here

mehmetatacan avatar Mar 24 '20 15:03 mehmetatacan

please, solv this asap, can't go on :-(

elvenbyte avatar Mar 25 '20 07:03 elvenbyte

Just disable ivy in tsconfig.app.json (and in tsconfig.server.json if you use Angular Universal) "angularCompilerOptions": { "enableIvy": false }, Not all the main libraries already support Ivy, so the only solution to disable it Hope, it helps

fess-v avatar Mar 25 '20 16:03 fess-v

Or use fork that is compatible with Angular 9 https://github.com/gilsdav/ngx-translate-router

gilsdav avatar Mar 25 '20 21:03 gilsdav

Just disable ivy in tsconfig.app.json (and in tsconfig.server.json if you use Angular Universal) "angularCompilerOptions": { "enableIvy": false }, Not all the main libraries already support Ivy, so the only solution to disable it Hope, it helps

Thanx a lot, but it doesn't help. I'm working with iv class, so I need to use Ivy, 'cause I'm working with an already done project, but thanks anyway.

elvenbyte avatar Mar 26 '20 07:03 elvenbyte

Or use fork that is compatible with Angular 9 https://github.com/gilsdav/ngx-translate-router

It didn't work either, even installing version 3, recommended for angular 8/9.

elvenbyte avatar Mar 26 '20 08:03 elvenbyte

Can someone fix it for a compatibility with INY and Angular 9?

Here is a PR about that #174

Maybe it needed to fix the yaml file for CI and replace node v8 with node v12 to make this PR successful?

I supposed we must wait for it. It should be ready in some days, I hope.

elvenbyte avatar Mar 26 '20 08:03 elvenbyte

@elvenbyte I have no known issues with Angular 9 (official release, not RC) and node 12. You can check that my demo have Ivy enabled. What type of errors do you have ?

gilsdav avatar Mar 26 '20 10:03 gilsdav

@elvenbyte I have no known issues with Angular 9 (official release, not RC) and node 12. You can check that my demo have Ivy enabled. What type of errors do you have ?

ERROR in node_modules/localize-router/src/localize-router.module.d.ts:33:68 - error NG6005: LocalizeRouterModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type. If this occurrence is in library code you don't control, please contact the library authors.

elvenbyte avatar Mar 31 '20 11:03 elvenbyte

Any news?

saharati avatar Apr 09 '20 07:04 saharati

I have migrated to Nextjs https://github.com/zeit/next.js/

chiqui3d avatar Apr 09 '20 08:04 chiqui3d

Please check this https://github.com/gilsdav/ngx-translate-router. it may help.

clk0115 avatar Jul 04 '20 05:07 clk0115

Looks like the project is dead. There are no release since January.

tycoonm avatar Dec 12 '20 11:12 tycoonm