I don't think it's a good idea to use bootstrap with just css. If you do absolutely want to do that, you can try this

<link href="https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="modal text-center show" tabindex="-1" id="withScrollExampleModal" style="display: block">
  <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title fw-normal">Basic dialogue title</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
          <i class="fa-light fa-circle-xmark"></i>
        </button>
      </div>
      <div class="modal-body f-14">
        <p>Lorem ipsum dolor sit amet consectetur. Enim libero commodo nibh vitae sed laoreet magna dui pharetra.
        </p>
      </div>
      <div class="modal-footer d-flex justify-content-center">
        <button type="button" class="btn btn-secondary rounded-pill" data-bs-dismiss="modal">Action 1</button>
        <button type="button" class="btn btn-outline-primary rounded-pill">Action 2</button>
      </div>
    </div>
  </div>
</div>

You need to add the show css class on the modal and also set display: block on that div. But without the js, you won't see the transitions, the backdrop or dismiss the model.

Bootstrap suggests using https://ng-bootstrap.github.io/ if you're using it in angular

Answer from V.S on Stack Overflow
Top answer
1 of 3
1

I don't think it's a good idea to use bootstrap with just css. If you do absolutely want to do that, you can try this

<link href="https://cdn.jsdelivr.net/npm/bootstrap@latest/dist/css/bootstrap.min.css" rel="stylesheet"/>
<div class="modal text-center show" tabindex="-1" id="withScrollExampleModal" style="display: block">
  <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title fw-normal">Basic dialogue title</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
          <i class="fa-light fa-circle-xmark"></i>
        </button>
      </div>
      <div class="modal-body f-14">
        <p>Lorem ipsum dolor sit amet consectetur. Enim libero commodo nibh vitae sed laoreet magna dui pharetra.
        </p>
      </div>
      <div class="modal-footer d-flex justify-content-center">
        <button type="button" class="btn btn-secondary rounded-pill" data-bs-dismiss="modal">Action 1</button>
        <button type="button" class="btn btn-outline-primary rounded-pill">Action 2</button>
      </div>
    </div>
  </div>
</div>

You need to add the show css class on the modal and also set display: block on that div. But without the js, you won't see the transitions, the backdrop or dismiss the model.

Bootstrap suggests using https://ng-bootstrap.github.io/ if you're using it in angular

2 of 3
0

Bootstrap has build in functions to open and close modals. For example there is a button that should open a modal, in that button there needs to be a data toggle like data-toggle="modal" and the target id of the modal like data-target="#Id of the modal" Further the modal itself hass to have a class called "modal" and a id. This id has to be the same as the data-target. Here is an example of a modal.

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

For this to work make sure to import the following items in the head

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
    

For more information on modals in bootstrap go to the following link https://getbootstrap.com/docs/4.0/components/modal/

🌐
GitHub
github.com › mdbootstrap › Angular-Bootstrap-with-Material-Design › issues › 66
Modal not working · Issue #66 · mdbootstrap/mdb-angular-ui-kit
January 18, 2017 - You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. ... I added this code to my angular 5 template file, but nothing happens each time i click ...
Author   chrisgeek
🌐
MDBootstrap
mdbootstrap.com › standard › material design for bootstrap 5 & vanilla javascript
Modal is not wotking - Material Design for Bootstrap
In modal wherever you find mdb-modal change it to bs-modal or if any other prefix that was used earlier and the modal should work fine. omerabbas pro commented 7 years ago @Parik yes you are absolutely right they updated the docs to latest version without updating the components. i bought the angular version three weeks ago but now i am unable to use docs because i have 4.2 MDB Angular.
🌐
GitHub
github.com › angular-ui › bootstrap › issues › 6408
Modal not working in bootstrap 4.6 · Issue #6408 · angular-ui/bootstrap
December 14, 2016 - Angular UI was working until [alpha 5] but with the new version the modal does not appear at all. What I've noticed is that show class is missing. $uibModal.open({ animation: true, templateUrl: templateUrl, controller: function modalCont...
Author   rossanmol
🌐
GitHub
github.com › shlomiassaf › ngx-modialog › issues › 280
Modal not showing when used with Bootstrap V4 · Issue #280 · shlomiassaf/ngx-modialog
January 11, 2017 - The reason was a breaking change in Bootstrap 4.0.0-alpha.6. In earlier Versions, class="fade in" on the modal caused it to a) be hidden and b) smoothly appear. It seems that the "in" class has now been renamed to "show". angular2-modal gives its element the classes "fade in" however, so they just disappear.
Author   nielsboecker
🌐
Plunker
embed.plnkr.co › sPPB0Cq0PUg1jmzzZtXh
problem with angular - bootstrap $modal. after opening once and closing, doesn't really want to open again. - Plunker
'use strict'; var solutionMod = angular.module('solution', []); /** * service to show modal */ solutionMod.factory('solutionModalService', ['$window', '$rootScope', '$log', '$modal', function($window, $rootScope, $log, $modal) { $rootScope.$on('show-modal-solution', function(event,data) { console.log('modal service react to show-modal broadcast') showTheModal(data); }); function showTheModal(data) { // var modalPromise = data = data || {}; $modal.open({ templateUrl: 'modal.html', controller: 'SolutionModalCtrl', backdrop: 'static', keyboard: true }); //added this because of a prob with modal n
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 29633283 › angularjs-not-working-in-bootstrap-modal
AngularJs not working in Bootstrap Modal - Stack Overflow
Bootstrap uses a lot of things in location.hash for controls, which conflicts with angular routing. The issue is that when Bootstrap pops up a modal, angular has no idea that happened, and that it has a new part of the DOM to compile.
Top answer
1 of 2
8

You can use ngx-bootstrap library to do this. After installing the library, follow these steps.

Step1: add the following code to app.module.ts file.

import { ModalModule, BsModalRef } from 'ngx-bootstrap';

@NgModule({
 imports: [ModalModule.forRoot(),...],
 providers: [BsModalRef]
})

Step2: copy the following code and paste to app.commponent.html.

    <button type="button" class="btn btn-primary" (click)="openModal(template)">Create template modal</button>

<ng-template #template>
    <div class="modal-header">
        <h4 class="modal-title pull-left">Modal</h4>
        <button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    <div class="modal-body">
        This is a modal.
    </div>
</ng-template>

Step3: and finally the following code copy to app.component.ts.

import { Component, TemplateRef } from '@angular/core';
import { BsModalService } from 'ngx-bootstrap/modal';
import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';

export class AppComponent {
    modalRef: BsModalRef;
    constructor(private modalService: BsModalService) {}

    openModal(template: TemplateRef<any>) {
        this.modalRef = this.modalService.show(template,{ backdrop: 'static', keyboard: false });
    }
}
2 of 2
-4

Can you try adding TetherJS after jQuery while importing the bootstrap cdn

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
🌐
GeeksforGeeks
geeksforgeeks.org › angularjs › how-to-make-a-bootstrap-modal-popup-in-angular-9-8
How to make a Bootstrap Modal Popup in Angular 9/8 ? - GeeksforGeeks
July 23, 2025 - We will follow the below steps to make this project. Step 1: Install the bootstrap using the following command. In order to use the bootstrap, first, we need to install it in our workspace by using the ...