Encountering the error message "AngularJS error: $(...).modal is not a function" after updating from Bootstrap 3.3.6 to version 4.0

Since updating the bootstrap version in my application from 3.3.6 to 4, I've been encountering an error stating that $(...).modal is not a function. This was previously working fine before the update.

angular.js:14700 TypeError: $(...).modal is not a function
at ReviewQueueController.js?V=1.2:122
at angular.js:20440
at completeOutstandingRequest (angular.js:6362)
at angular.js:6642

I utilize modal in AngularJS for displaying success messages, errors, or any other information. I tried to replicate the issue on a Fiddle but couldn't succeed.

As I am relatively new to AngularJS, I'm unsure about how to resolve this issue.

Link to Fiddle

After researching various posts, it was suggested to make changes to the CSS:

.fade.in {
  opacity: 1;
}

.modal.in .modal-dialog {
   -webkit-transform: translate(0, 0);
   -o-transform: translate(0, 0);
    transform: translate(0, 0);
 }

.modal-backdrop.in {
    filter: alpha(opacity=50);
    opacity: .5;
 }

Many sources also recommended using noconflict as mentioned here. However, I am uncertain about how to implement noconflict with AngularJS.

I would appreciate any suggestions on how to fix this issue.

Answer №1

In their GitHub repository, one approach suggested is to include the following code in your HTML:

<!-- Enable bootstrap 4 theme -->
<script>window.__theme = 'bs4';</script>

You may also need to deactivate ViewEncapsulation in the app.component.ts file.

To learn how to disable CSS Encapsulation, check out the information provided here.

UPDATE:

If you're encountering issues with your fiddle, it could be due to the absence of the jQuery script file. I have included it for you so that everything functions properly:

Click here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Result of jQuery Ajax responseText: "An issue occurred while processing your request."

I encountered an issue with the UAT environment where I received the error message "There was an error processing the request". Interestingly, the code works fine in my local environment. The line Utility.WriteLogEvent("TestService", strMessage); is respo ...

The issue of webkit animation rotation malfunctioning on Nexus Mobile devices

I'm currently working on developing a double ring radar animation within an Ionic hybrid application. The animation functions perfectly when viewed in a web browser, however, I've encountered issues when attempting to run it on the Nexus mobile ...

Unable to get jquery toggle() to function in chrome or safari

Having trouble with the toggle() function in Chrome and Safari. I've tried using noconflict() but it hasn't worked. In Chrome and Safari, the first recipe translation appears below the German one. The other 2 recipes are working as expected. How ...

Conflicts between Bootstrap Validator and Ajax.BeginForm in Partial Views of MVC

My current issue involves using Ajax.BeginForm to post data on a form without refreshing the entire page. The goal is to validate a textbox - if it has a value, then the data should be posted; otherwise, a validation message should be displayed. However, I ...

The issue with ng-change is causing the previously selected drop down option to be cleared

After successfully implementing live searching with ng-change, I encountered an issue with a pre-selected drop-down box. Despite setting the selected="selected" attribute to make option three the default selection, the drop-down box jumps to the top optio ...

Eliminating padding or margin for figures in Bootstrap on smaller screens

I've been struggling to create a fullscreen image on small devices without any margin or padding. Unfortunately, the solutions suggested in this thread didn't work for me. Below is the code I'm currently using (tested on https://jsfiddle.n ...

What are the steps to add SVG effects to an image or div element?

Embarking on my first venture into using SVG graphics has left me feeling a bit bewildered. Despite extensive research, I have yet to stumble upon the answer to my current quandary. The objective at hand is to transform an image, assuming that the source ...

Angular is having trouble showing an image sourced from OMDBAPI

Currently, I am delving into the world of AngularJS. For my project, I aim to showcase movie posters sourced from http://www.omdbapi.com. HTML <div ng-app="moviesBrowserApp"> <div ng-controller="moviesCtrl"> <strong> ...

Toggle the on and off functionality of a button using ajax response for content display

I'm struggling to figure out why the button isn't working for me. I am familiar with how to enable and disable buttons using attr and prop. $(document).on("click", "#btn", function(){ $(this).html("Sending..."); $(this).prop("disabl ...

Replicating form fields using jQuery

I have come across many questions similar to mine, but unfortunately none of them address the specific details I am looking for. On a single page, I have multiple forms all structured in the same way: <form> <div class="form-group"> ...

How to create centered striped backgrounds in CSS

Attempting to achieve a background similar to the one shown Can this be accomplished using CSS? ...

The functionality of oTable.fnFilter is malfunctioning

I'm trying to implement a search functionality in the thead section of datatables, but unfortunately it's not functioning as expected. $("#listings_row thead input").keyup( function () { oTable.fnFilter( this.value, $(this).attr('id&apo ...

Creating evenly spaced PHP-generated divs without utilizing flexbox

My goal is to display images randomly from my image file using PHP, which is working fine. However, I am facing an issue with spacing the images evenly to fill the width of my site. This is how it currently appears: https://i.stack.imgur.com/AzKTK.png I ...

CSS: Stack elements vertically based on their height (column-wise)

Looking for some help with designing a menu where the list items float in columns instead of rows. For example, This is how my current menu looks like: I want to change the layout to look like this: My code for the list items is as follows: .mnu-third ...

Ng-repeat failing to apply checkbox functionality

When someone clicks on the levels in a list, I need to call a method in AngularJs. However, clicking on the checkbox within the ng-repeat does not trigger any action. Strangely, when I click on the checkbox outside of the ng-repeat, it works fine. Here is ...

Encountering issue: LineChart is not recognized as a constructor, resulting in failure to display chart on webpage

I am struggling with displaying a chart in my HTML file that should show the details of a specific process from the past few minutes. Whenever I try to initialize the chart using google.charts.load('current', {'packages':['line&apo ...

Unable to arrange an array of JavaScript objects retrieved via an Angular REST request

I'm currently encountering an unusual issue with sorting an array of JavaScript objects. While sorting some dummy data works fine, I am unable to sort the array when fetching the object through an Angular REST call. The structure of the message is as ...

Ways to determine the count of arrays within a JSON data structure

Displayed below is a JSON object with multiple arrays. The goal is to extract the number and name of each array within this object. Since the object is dynamically generated, the quantity and names of the arrays are unknown. In this example, there are tw ...

Troubleshooting: Issues with $location.path not updating in AngularJs

While I understand that this issue has been discussed previously, none of the provided solutions seem to work. I have a good understanding of Angular and have written a substantial amount of Angular code, so I am not a novice in this field. Currently, I ...

Exploring Event Propagation in AngularJS

Currently, I am working on developing a web application using angularjs for the first time. A key feature that I aim to introduce is the ability for users to create a div in the main window upon clicking on an image in the menu. To achieve this functional ...