0

I'm using the angular-cli .net core starter. Now I'm adding my own css + javascript and getting following error:

An unhandled exception occurred while processing the request. Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Bootstrap's JavaScript requires jQuery

I already tried:

npm install jquery 

+

import $ from 'jquery'; => in app component

How do you configure jquery with webpack / angular2 ?

Thanks!

1
  • Why not using a dedicated Bootstrap + Angular integration that doesn't require jQuery nor Bootstrap's JS at all? ng-bootstrap.github.io Commented Mar 23, 2017 at 9:24

2 Answers 2

1

Install the type definitions:

npm install @types/jquery
Sign up to request clarification or add additional context in comments.

Comments

0

steps

  1. npm install jquery — save

  2. Add "scripts": [ "../node_modules/jquery/dist/jquery.min.js" ] to angular-cli.json file

  3. Import it into the component : import * as $ from 'jquery';

  4. Example:

    $(document).ready(function(){
        $("button").click(function(){ 
         ...
       } 
    });
    

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.