TwanoO67 / ngx-admin-lte

Admin LTE for Angular 2/4/6/8 as a NPM package
MIT License
109 stars 47 forks source link

Runtime error with Angular 5, TypeScript 2.7 etc #46

Open catull opened 6 years ago

catull commented 6 years ago

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

> integrator-ui@0.0.3 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

> integrator-ui@0.0.3 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');
}
fabioformosa commented 6 years ago

me too

TwanoO67 commented 6 years ago

Hello guys,

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

TwanoO67 commented 6 years ago

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

fabioformosa commented 6 years ago

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.

catull commented 6 years ago

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

TwanoO67 commented 6 years ago

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.

catull commented 6 years ago

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.