I am currently developing an Ionic app and I was wondering if I could add an image gallery based on Bootstrap. I know Ionic and Bootstrap don't work really well together, but I was wondering if it is possible.
With Ionic 4, this can be done easily by making use of the angular.json file open the angular.jsonfile, this can be located at the root of your project locate the the styles array, add the path to the downloaded bootstrap file
We have to use the ng-bootstrap library to demonstrate a few examples of using the bootstrap component in Ionic. Difference between bootstrap and ng-bootstrap ? Both bootstrap and ng-bootstrap are front-end frameworks created by Twitter. The ng-bootstrap is built specifically for an Angular. The official definition of ng-bootstrap
If you're having an Ionic application created with jQuery in which you're having an initialized npm project, please install the MDB jQuery from npm / gitlab, and then import necessary mdb js / css files in index.html (or another main .html file in your application).
However, this ionic forum answer ( Web version in ionic 2) from a moderator states that Ionic 2 apps cannot be hosted as stand-alone web apps yet, but that the functionality is “in the works”. Other problems I have heard about are resource issues, as serving an Ionic app would create a separate instance for every remote user.
Step 1:
Install bootstrap:
npm install bootstrap
Get bootstrap
Step 2:
Edit package.json:
"description": "An Ionic project",
......
"config": {
"ionic_sass": "./sass.config.js"
}
Step 3:
Create new file sass.config.js in home folder
module.exports = {
includePaths: [
"node_modules/ionic-angular/themes",
"node_modules/ionicons/scss",
"node_modules/ionic-angular/fonts",
"node_modules/bootstrap/scss"
]
};
Step 4:
Edit variables.scss
@import "noto-sans";
......
@import "bootstrap";
Step 5:
Add your bootstrap code:
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
Step 6:
Run ionic app
ionic serve
According to this article Ionic + Twitter’s Bootstrap CSS Framework - Again!, it will be a lot of effort using bootstrap. However I found this slider for you How to Create Elegant Slider Carousel in Ionic Framework.
I hope it helps you! Good luck! ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With