最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to include popper.js and bootstrap.js in angular project - Stack Overflow

programmeradmin5浏览0评论

I am using angular with openlayers and I am following the example posted below in the link:

        .html

the aforementioned link provide the following information in order to work with the popover:

Things to know when using the popover plugin:
Popovers rely on the 3rd party library Popper.js for positioning. You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js in order for popovers to work!

please let me know how to include

popper.js 

and

bootstrap.js 

so i can work with the popover function and get it working.

image:

I am using angular with openlayers and I am following the example posted below in the link:

        https://openlayers/en/latest/examples/overlay.html

the aforementioned link provide the following information in order to work with the popover:

Things to know when using the popover plugin:
Popovers rely on the 3rd party library Popper.js for positioning. You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper.js in order for popovers to work!

please let me know how to include

popper.js 

and

bootstrap.js 

so i can work with the popover function and get it working.

image:

Share Improve this question edited Mar 30, 2021 at 7:34 Amrmsmb asked Mar 30, 2021 at 6:39 AmrmsmbAmrmsmb 11.4k33 gold badges122 silver badges254 bronze badges 2
  • popper is included with bootstrap, just installing boostrap and including the dist file from node_modules in angular.json would be fine. getbootstrap./docs/5.0/getting-started/contents/#js-files – Gowtham Raj J Commented Mar 30, 2021 at 7:00
  • Use this library – Pieterjan Commented Sep 29, 2023 at 11:57
Add a ment  | 

5 Answers 5

Reset to default 2

You can add node_modules/dist/css/boostrap.min.css in styles under the build section of angular.json file BEFORE src/styles.css. You can download the bootstrap from the npm package npm install bootstrap

In order to work with the pop ups you can add the bundle file of bootstrap node_modules/bootstrap/dist/js/bootstrap.bundle.min.js in the scripts under the build section of the same file.

EDIT: You have to download JQuery and add it to your scripts section as well.

There are some step that you have to follow.

-1. Install Jquery like npm instll jquery -save
-2. Install latest bootStrap npm install [email protected] --save
-3. Install Popper js like npm install popper.js --save

And then add styles and scripts into angular.json file like

========================================================================

for external JavaScript or any file that you want to implement on angular. you have to set path for that files on angular.json file

angular.json

for angular older version need set path on .angular.cli.json

Note :- after changes on angular.json file, you have to repile or restart project.

you can import files into index.html file.

It's more easy to import bootstrap in the index.html file like this.

You can find the link here https://getbootstrap./

Just use npm to install :-

[propper]: > https://www.npmjs./package/propper

npm i propper --save

[bootstrap]: > https://www.npmjs./package/bootstrap

npm i bootstrap --save

发布评论

评论列表(0)

  1. 暂无评论