gilsdav / ngx-translate-router

Translate routes using ngx-translate
131 stars 43 forks source link

Circular dependency in DI detected for MatDialog / MatBottomSheet #130

Closed maximegasque closed 2 years ago

maximegasque commented 2 years ago

Hello guys, since I updated to NG 14 + ngx-translate-router 5.0.0, it seems like we have a circular dep issue between angular material and the lib. ( I have the same with MatBottomSheet)

image

Am I the only one to face this issue ? Thx

JamesIves commented 2 years ago

I'm also seeing this issue after upgrading to 5.0.0 w/ Angular 14.1.1 (including Material). Downgrading to 4.0.1 resolves it.

daco commented 2 years ago

I'm seeing the same error, but downgrading to 4.0.1 gives me the #125 Cannot read properties of undefined (reading 'afterPreactivation') error again, the reason I upgraded to 5.0.0 in the first place.

himxx commented 2 years ago

Same problem here. Is there any solution for this ??

daco commented 2 years ago

@himxx Unfortunately I have not found a solution. Would be great if someone a bit smarter than I am did!

himxx commented 2 years ago

@daco It's sad

thomasmarcelin commented 2 years ago

I had the same issue.

Downgrading Angular version from 14.1.2 to 14.0.5, as suggested in the package.json of the 5.0.0 release, might have fixed the issue for me, but it needs more investigation as I only did basic testing of where I had the issue before.

Here is the relevant part of my package.json:

"dependencies": {
        "@angular/animations": "14.0.5",
        "@angular/cdk": "14.0.5",
        "@angular/common": "14.0.5",
        "@angular/compiler": "14.0.5",
        "@angular/core": "14.0.5",
        "@angular/forms": "14.0.5",
        "@angular/material": "14.0.5",
        "@angular/platform-browser": "14.0.5",
        "@angular/platform-browser-dynamic": "14.0.5",
        "@angular/platform-server": "14.0.5",
        "@angular/router": "14.0.5",
        "@angular/service-worker": "14.0.5",
        "@angular/youtube-player": "14.0.5",
        "@gilsdav/ngx-translate-router": "5.0.0",
    },
    "devDependencies": {
        "@angular-builders/custom-webpack": "14.0.1",
        "@angular-devkit/build-angular": "14.0.5",
        "@angular-devkit/core": "14.0.5",
        "@angular-eslint/builder": "14.0.5",
        "@angular-eslint/eslint-plugin": "14.0.3",
        "@angular-eslint/eslint-plugin-template": "14.0.3",
        "@angular-eslint/template-parser": "14.0.3",
        "@angular/cli": "14.0.5",
        "@angular/compiler-cli": "14.0.5",
        "@angular/language-service": "14.0.5",
    },
thomasmarcelin commented 2 years ago

After further investigation, it seems that the error occurs on Angular v14.1.0, latest working version is v14.0.7

Relevant changelog : https://github.com/angular/angular/blob/main/CHANGELOG.md#1410-2022-07-20

There are a few things affecting @angular/router, but no breaking changes, only deprecations

himxx commented 2 years ago

How correctly downgrade to specific version? My angular is 14.2.0

thomasmarcelin commented 2 years ago

How correctly downgrade to specific version? My angular is 14.2.0

I changed my package.json accordingly, you can see my example (only the relevant parts) for v14.0.5. Then you can yarn or npm i

Maybe it's possible with ng update but I haven't tried it

JSProto commented 2 years ago

LocalizedRouter need fix:

need add flag in injector['get']

module.injector['get'] = (token, notFoundValue, flag) => {
    const getResult = getMethod(token, notFoundValue, flag);
giacomo commented 2 years ago

@gilsdav seems that the changes showed by @JSProto should work.

gilsdav commented 2 years ago

Can you confirm it's fully fixed in version 5.1.1 ?

giacomo commented 2 years ago

@gilsdav I will test tomorrow, using the patch today was working fine ...

giacomo commented 2 years ago

@gilsdav now testet the all day! it works fine

daco commented 2 years ago

I can also confirm that it works. Great!

gilsdav commented 2 years ago

Thanks for your feedbacks :)