ngx-admin-lte icon indicating copy to clipboard operation
ngx-admin-lte copied to clipboard

Runtime error with Angular 5, TypeScript 2.7 etc

Open catull opened this issue 6 years ago • 7 comments

I have the following dependencies:

   "dependencies": {
        "@angular/common": "^5.2.6",
        "@angular/compiler": "^5.2.6",
        "@angular/core": "^5.2.6",
        ........
        "@angular/http": "^5.2.6",
        "admin-lte": "2.3.11",
        "ngx-admin-lte": "1.0.1",
        "rxjs": "^5.5.6",
        "zone.js": "^0.8.20"
    },
    "devDependencies": {
        "@angular/cli": "^1.7.1",
        "@angular/compiler-cli": "^5.2.6",
        .........
        "tslint": "~5.9.1",
        "typescript": "^2.7.2"
    }

I have seen this error with angular 4, also with @angular/cli 1.5.x and 1.6.x. Also, the error appeared using TypeScript 2.4, 2.5 and 2.6.

Never got around to opening an issue for the error.

So, here's the error when npm starting my angular app:

npm run start

> [email protected] start:local /Users/carlo/workspace/java/d+h/inuc/core-master.git/adapter/integrator-ui/src/main/ng
> npm run lint && ng serve --environment dev

> [email protected] lint src
> ng lint

All files pass linting.
** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/integrator-ui **
Date: 2018-02-26T20:42:41.578Z
Hash: 89e43edbf054446544a5
Time: 13004ms
chunk {inline} inline.bundle.js (inline) 3.86 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.91 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 577 bytes [initial] [rendered]
chunk {scripts} scripts.bundle.js (scripts) 1.67 MB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 1.28 MB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 852 kB [initial] [rendered]

ERROR in node_modules/ngx-admin-lte/src/ngx-admin-lte.module.ts(14,36): error TS2345: Argument of type 'HttpClient' is not assignable to parameter of type 'HttpClient'.
  Types have separate declarations of a private property 'handler'.


webpack: Failed to compile.

The lines in question are

export function HttpLoaderFactory(httpClient: HttpClient) {
    return new TranslateHttpLoader(httpClient, 'assets/i18n/', '.json');
}

catull avatar Feb 26 '18 21:02 catull

me too

fabioformosa avatar Mar 05 '18 17:03 fabioformosa

Hello guys,

To achieve that i need help on issue #47 If you have any idea it would be much appreciated

TwanoO67 avatar Mar 07 '18 18:03 TwanoO67

seems fixed by 2.0.0.beta-7 Can you confirm ?

TwanoO67 avatar Mar 09 '18 12:03 TwanoO67

I confirm. Don't forget to update documentation, as reported here https://github.com/TwanoO67/ngx-admin-lte/issues/47#issuecomment-371792728, to fix assets path. Thank you.

fabioformosa avatar Mar 12 '18 11:03 fabioformosa

Interestingly, I never had to fiddle with the asset path configuration. Can be closed now.

catull avatar Mar 12 '18 20:03 catull

Assets are needed for the translation files and for default img, like avatar.

Documentation README is up to date on the relative branche, it will appear on github page when the branch will not be beta anymore.

TwanoO67 avatar Mar 12 '18 20:03 TwanoO67

Ah, I see. Never seen any runtime errors, because my web app does not have a need for translation or avatars. Kind of low-key, non-social bare bootstrap with menus and buttons/links.

catull avatar Mar 12 '18 20:03 catull