Skip to content

WebPack: jquery + bootstrap-sass #1622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Daredzik opened this issue Aug 10, 2016 · 6 comments
Closed

WebPack: jquery + bootstrap-sass #1622

Daredzik opened this issue Aug 10, 2016 · 6 comments
Labels
feature Issue that requests a new feature P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Comments

@Daredzik
Copy link

Daredzik commented Aug 10, 2016

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Debian 8.5
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
angular-cli: 1.0.0-beta.11-webpack
node: 6.2.2
os: linux x64
  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.

npm install --save jquery
npm install --save bootstrap-sass

now in pollyfils.ts add:

import 'jquery';
import 'bootstrap-sass/assets/javascripts/bootstrap';

ng serve

  1. The log given by the failure. Normally this include a stack trace and some
    more information.
    in bundled js, i can find jquery lib, but in console i get 'Error: Bootstrap's JavaScript requires jQuery'
  2. Mention any other details that might be useful.
    i try the way to add in main.ts
    import $ from 'jquery'; or import * as jQuery from 'jquery'; but nothing change.

Any ideas ?

@choucry13
Copy link

@Daredzik try this :
npm install --save @types/jquery
npm install --save jquery
use import * as jQuery from 'jquery' in your typescript file. @types works with the [email protected]

@Daredzik
Copy link
Author

@choucry13
nope didn't work.

For now i include jquery in index.html file and store it in public dir.

@lbecker34
Copy link

@Daredzik Not sure what your reason is for using the bootstrap/jquery combination. This angular2 package has everything you need to use bootstrap with Angular2. https://github.com/valor-software/ng2-bootstrap

@filipesilva filipesilva added feature Issue that requests a new feature P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful feature: webpack labels Aug 16, 2016
@filipesilva
Copy link
Contributor

@Daredzik the ability to add global javascript (like jquery) is currently missing. This is something we're actively working on and probably the biggest priority at the moment.

@filipesilva
Copy link
Contributor

Closed in favor of #1717, which better captures this feature.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

No branches or pull requests

4 participants