简体   繁体   中英

Install offline Bootstrap in Angular

I don't have any way to have internet on my pc and I want to install Bootstrap in my Angular project by downloading it and calling it in my index.html so i can use it offline. Can't use npm i or anything related to internet besides downloading the Bootstrap zip

I just put its folder in "src" and called it with:

<link rel="stylesheet" href="src\bootstrap\css\bootstrap.min.css">

<script src="src\bootstrap\js\bootstrap.min.js"></script>

This isn't working, should I download also popper.js and Jquery? Or should I change something in Angular.json ?

Try using assets folder for static files.So move your files to assets and change links like

<link rel="stylesheet" href="assets\bootstrap\css\bootstrap.min.css">

<script src="assets\bootstrap\js\bootstrap.min.js"></script>

Also you will need to add jquery as well

Put the files in the assets folders. It's better to import those files in angular.json instead of index.html . You will also have to include JQuery and popper as in official bootstrap documentation:

Many of our components require the use of JavaScript to function. Specifically, they require jQuery, Popper.js, and our own JavaScript plugins.

"styles": [
  "src/assets/bootstrap/css/bootstrap.min.css""
],
"scripts": [
  "src/assets/jquery/remainingpath...",
  "src/assets/popper/remainingpath...",
  "src/assets/bootstrap/js/bootstrap/bootstrap.min.js"
]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM