1

Would it be possible to use jQuery Bootstrap with Aurelia? There are some toggle buttons and other components I would like to use that come with Bootstrap.

So far, all of the examples I have seen are using jQuery UI along with Aurelia.

Dwayne Charrington
  • 6,524
  • 7
  • 41
  • 63
user636525
  • 3,180
  • 9
  • 38
  • 51

1 Answers1

1

Take a look at the skeleton-navigation project. It uses bootstrap by default:

https://github.com/aurelia/skeleton-navigation/tree/master/skeleton-es2016

The magic happens here

https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-es2016/src/main.js#L1

import 'bootstrap';

Note that bootstrap is installed via JSPM.

Matthew James Davis
  • 12,134
  • 7
  • 61
  • 90
  • So can i do an import $ from 'jquery' and start using JQuery bootstrap components , say $('#myModal').modal() ? – user636525 Feb 19 '16 at 00:16
  • correct, or you could simply leave $ in the global namespace – Matthew James Davis Feb 19 '16 at 00:37
  • some examples uses import $ from 'bootstrap'; is that what I should do too ? – user636525 Feb 19 '16 at 00:45
  • I'm not familiar with that syntax. That might be for a boostrap+jquery build. Can't help you there. – Matthew James Davis Feb 19 '16 at 00:47
  • Okay that was my original question., sorry i was not clear.using JQuery Bootstrap framework along with Aurelia.. I think that is the way i should do it. – user636525 Feb 19 '16 at 00:50
  • 1
    As far as I know the Bootstrap 3 JavaScript components are jQuery plugins. So they just add on to jQuery and that's why you can use `import $ from 'bootstrap'. http://stackoverflow.com/questions/34996551/how-to-import-bootstrap-datetimepicker-into-aurelia-project also has this topic. – Volker Rose Feb 19 '16 at 06:37
  • @VolkerRose thanks That make sense. But in case if i need to shim one more "global" JQuery Plugin with JSPM, say xxxPlugin, how does it work when i try to use import $ from xxxPlugin ?Can i still use import $ from bootstrap and avail all methods from the xxxPlugin ? – user636525 Feb 21 '16 at 04:51
  • @user636525, that is a good point e.g. question, which I also want to know. Maybe it deserves its own place? Can you post it as a separate question? – Volker Rose Feb 22 '16 at 07:20
  • @VolkerRose we just need to add one import $ , JQuery plugins adds their methods to the JQuery wrapper. I tested and its working fine.http://stackoverflow.com/questions/5089583/attach-multiple-jquery-plugins-onto-a-single-element – user636525 Feb 22 '16 at 14:26
  • Ok, great. Thanks for letting me/us know :) – Volker Rose Feb 23 '16 at 06:24