angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Issue with loading third party library in Angular 6

Open Santhosh25 opened this issue 8 years ago • 5 comments

Issue with loading third party library which is dependence on another third party library. In my case, i'm using bootstrap(v3.3.7) which is required JQuery. I included these libraries as per angular suggested way and successfully compile the application, if run it in browser i got a console error.

Versions

"dependencies": {
    "@angular/animations": "^6.0.0",
    "@angular/common": "^6.0.0",
    "@angular/compiler": "^6.0.0",
    "@angular/core": "^6.0.0",
    "@angular/forms": "^6.0.0",
    "@angular/http": "^6.0.0",
    "@angular/platform-browser": "^6.0.0",
    "@angular/platform-browser-dynamic": "^6.0.0",
    "@angular/router": "^6.0.0",
    "@types/bootstrap": "^3.3.33",
    "@types/jquery": "^3.3.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.5.4",
    "jquery": "3.3.1",
    "malihu-custom-scrollbar-plugin": "3.1.5",
    "rxjs": "^6.0.0",
    "zone.js": "^0.8.26"
  }

Sample code

angular.json angular-json

app.component.ts app-component

Console Error

bootstrap

Santhosh25 avatar May 11 '18 06:05 Santhosh25

did u add bootstrap js? also u can use CDN for them

WandererInVoids avatar May 13 '18 20:05 WandererInVoids

@WandererInVoids yes, i have installed bootstrap via npm and include it in angular.json file. I'm facing this issue not only for bootstrap also occur materialize-css . Is angular changed the way of loading/including third party library files to application?

Santhosh25 avatar May 14 '18 06:05 Santhosh25

Any updates on this issue??

aburht avatar Aug 04 '18 18:08 aburht

You are setting jQuery as a global, however you are importing using a direct import. This will result in having jQuery twice in your application.

See https://github.com/angular/angular-cli/wiki/stories-global-scripts#using-global-libraries-inside-your-app and https://github.com/angular/angular-cli/wiki/stories-third-party-lib

This issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular-cli.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

alan-agius4 avatar Nov 20 '18 14:11 alan-agius4

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.