skip to Main Content

I would like to get some advice on the most appropriate way to do dependency management for external client side libraries with Angular 2.

Previously I have used Bower with Angular 1.x, but it appears a number of sources have suggested that this is not a good idea as it doesn’t work well with TypeScript and ES6.

Ultimately I want to be able to manage dependencies for things like jQuery and Twitter Bootstrap in my Angular app without having to hard code a bunch of stuff directly with tags.

The Angular 2 documentation seems to be completely silent on this matter. The only thing that is clear is that it uses SystemJS as a module loader, but this doesn’t solve the dependency management side of things.

I would really appreciate it if I could be pointed in the right direction.

2

Answers


  1. Start a project with angular-CLI and follow this documentation.

    Those are basic steps to adding dependency into a project.

    • Installing package with npm and install typings
    • Adding package file location into the angular-cli configuration to bundling.
    • Making configuration of systemjs as mapping location of file and package configuration in systemjs as default file format and main file setting (it can change as main.js, index.js, jquery.js, d3.js)
    • Now, you can import your 3-party package
    Login or Signup to reply.
  2. Best angular2 kick starter I have come across

    https://github.com/mgechev/angular2-seed

    How to add external libraries just follow this link
    https://github.com/mgechev/angular2-seed/wiki/Add-external-dependency

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search