How to import popper.js?

后端 未结 11 2229
广开言路
广开言路 2020-12-25 10:12

It seems to be a lame question, but I cannot to figure it out. How to import popper.js which comes toghether with Bootstrap 4 beta?

I use bower and I\'ve installed B

11条回答
  •  死守一世寂寞
    2020-12-25 10:51

    IN bootstrap 4 you need to add popper js for tooltip, I also don`t understand why bootstrap 4 includes external popper.js, It means bootstrap makes more complicated instead of easy when upgrading to the latest versions.

    You can import popper js before bootstrap on angular or a simple html, Angular import would be like this

    npm install popper.js --save
    

    then go to .angular-cli.json and change the order like below.

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

    you can also use CDN direct call popper js into your any project.

    https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.js https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.5/umd/popper.min.js

提交回复
热议问题