How to install popper.js with Bootstrap 4?

后端 未结 11 931
眼角桃花
眼角桃花 2020-12-07 17:17

From what I\'ve read so far, popper.js is a big pain with Bootstrap 4. I can\'t get it to work. I keep getting this error:

Error: Bootstrap dropdown r

11条回答
  •  长情又很酷
    2020-12-07 18:04

    Two different ways I got this working.

    Option 1: Add these 3

    Option 2 (Option 2 works with Angular, not sure about other frameworks)

    Step 1: Install the 3 libraries using NPM:

    npm install bootstrap --save

    npm install popper.js --save

    npm install jquery --save

    Step 2: Update the script: array(s) in your angular.json file like this:

    "scripts": ["node_modules/jquery/dist/jquery.min.js", "node_modules/popper.js/dist/umd/popper.min.js", "node_modules/bootstrap/dist/js/bootstrap.min.js"]
    

    (thanks to @rakeshk-khanapure above in the comments)

提交回复
热议问题