-1

I need to have jquery available into all my components of my application so that i can use like this

import jquery; and use the jquery api in all components

I am using SystemJS, Angular 2 and typescript. How can i achieve this ?

Regards

shabari
  • 63
  • 1
  • 1
  • 3
  • Possible duplicate of [How to use jQuery with Angular2?](http://stackoverflow.com/questions/30623825/how-to-use-jquery-with-angular2) – Fiddles Nov 28 '16 at 07:00

1 Answers1

0

You need to import jquery $ in your application and have to configure your systemjs loader where the jQuery library will be available

    //in your typescript angular2
    import * as $ from 'jQuery';

    // in your systemjs configuration
    //map

    (function(global) {
  // map tells the System loader where to look for things
  var map = {
    'app':                        'app', // 'dist',
    'jQuery':                     'node_modules/jQuery/lib/node-jquery.js',
  };

you can also import it in your html index.html like below

System.import('jQuery').catch(function(err){ console.error(err); });

Adjust your self to make it work

Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132