The ng-repeat directive is causing issues with the functionality of the Angular carousal

I am currently trying to create an Angular carousel for displaying image slides that are coming from an array. However, I am facing issues as it is not functioning as a slider.

Does anyone have a solution to fix this problem?

//HTML

<div id="myCarousel" class="carousel slide" data-ride="carousel"> 
    <div class="carousel-inner">
        <div class="item {{::($index === 0 ? 'active' : '')}}"  ng-repeat="img in vehicleImgArr"> <img src="{{img}}">
          <div class="container">
            <div class="carousel-caption"> </div>
          </div>
        </div>
    </div>
</div>
<ol class="carousel-indicators">
<li data-target="#myCarousel" ng-repeat="img in vehicleImgArr"  data-slide-to="{{img}}"></li>
</ol>

//JS

var app = angular.module('VehicleDetails', ['angularUtils.directives.dirPagination']);
  app.controller('vehiclefulldetails',['$scope', '$http', function($scope, $http){

    if($scope.vehicletrxdetails[0].document_name != null){
        $scope.vehicleImg = $scope.vehicletrxdetails[0].document_name;
        $scope.vehicleImgArr = $scope.vehicleImg.split(',');
    }


}]);

Example: vehicletrxdetails[0].document_name = https://files.allaboutbirds.net/wp-content/uploads/2015/06/prow-featured.jpg, https://www.scientificamerican.com/sciam/cache/file/268F292B-5DDD-4DB1-B5ABC6541A70ECDF_source.jpg

Any assistance on this matter would be greatly appreciated. Thank you in advance.

Answer №1

After some troubleshooting, I was able to resolve the issue by:

$("ol.carousel-indicators").on('click',function(event){
    event.preventDefault();
    $(this).parent().carousel($(this).data("slide"));
});

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

Combining multiple dictionaries into one single dictionary array using JavaScript

In my JavaScript code, I am working with an array that looks like this: arr = [{"class":"a"},{"sub_class":"b"},{"category":"c"},{"sub_category":"d"}] My goal is to transform t ...

Position the DIV in the center within another DIV that contains an image

Having trouble centering a DIV horizontally inside another DIV that contains an image? It can be tricky, especially when the image is added into the mix. I've attempted various methods, but my goal is to have box2 centered at the bottom of the parent ...

Ensure that only one checkbox is checked at a time and that unchecking one does not remove the

https://i.sstatic.net/EEC2U.png I am facing an issue with two checkboxes in my code. When I click on the first checkbox in the featured playlist section, another popular genre checkbox should be unchecked. However, only the value changes and the checked m ...

Save React code as a single HTML file

My current project involves creating one-page websites for a specific service that only accepts single inline HTML files. To make these webpages as modular as possible, I am utilizing React to create ready components. The challenge is exporting the final R ...

Tips for centering all icons in the navbar

* { padding : 0; margin : 0; } nav { padding : 20px; background-color : #809906; list-style : none; border-bottom : 2px solid black; } a { color : black; padding-right : 115px; } a:hover { color : ...

The Fab Button from Material UI remains beneath the left split-pane

Is there a way to ensure the Fab button is completely visible? The left side often gets hidden under the left pane. I attempted to increase the z-index, but it did not have any effect. View on CodeSandbox <UpperPane> <Fab ...

Avoiding using ID selectors when working with a checkbox hack

I've shared about my project previously. Twice, actually. While the responses have given me better insight into my situation, they haven't been directly applicable. I take responsibility for this as I was posting an incomplete version of the fina ...

Node.js equivalent of Java's byteArray

I have a Node.js REST API with images being sent from a Java application as byte arrays. Here is an image Below is the string representation of the image in byte array form: [B@c75af72 I need to decode this byte array to verify if it is indeed an ima ...

The callbacks from using Mongoose findById() only yield results for irrelevant information

I am currently using Mongoose for database operations. I am experiencing an issue where the findById() method is sometimes returning results, but not consistently: Case 1: Invalid Query models.Repo.findById("somefakeid", function(err, result){console.log ...

Error: Unable to access the 'login' property of an undefined object

An error occurred: Uncaught TypeError: Cannot read property 'login' of undefined........... import Login from '../components/Login.jsx'; import { useDeps, composeWithTracker, composeAll } from 'mantra-core'; export const com ...

What is the best way to detect modifications to scope variables within a directive?

Here are some instructions for HTML: <dropdown placeholder='' list='sizeWeightPriceArr' selected='selectedProductSize' property='size' value='size' style='width:60px;'></dropdown> Th ...

Adapt the CSS based on different screen sizes

I am currently developing a mobile application using angularjs and the ionic framework. My application is intended for both tablet and mobile versions. I have encountered an issue where I cannot use the same CSS for both the tablet and mobile versions. Is ...

Attempting to retrieve data from an object by utilizing an external URL, however

Upon starting the bot console, the console displays: Online with undefined/5 After 10 seconds, an error is thrown: undefined:1 [object Promise] ^ SyntaxError: Unexpected token o in JSON at position 1 This is the code snippet being used: let players clie ...

How to send parameters to the jquery .css() method

I'm attempting to create hyperlinks that can dynamically set inline styles for different elements on a webpage. I have managed to save the element and attribute settings in hidden span elements and retrieve them to display in an alert dialog. However, ...

Guide to efficiently centering the background image in your existing Bootstrap template

I'm currently working on ensuring that the background image stays within the user's window, regardless of the device being used. While I have successfully added the background image, I am facing challenges in centering it properly. The current ou ...

Creating a hierarchical visualization in Angular using a JSON object array

I'm currently working on creating a hierarchical view of users. My ultimate goal is to utilize this hierarchy view or something similar. The challenge lies in how the JSON objects used to construct the hierarchy are structured. Here's an example ...

Rotate the horizontal scroll of an inner div within an outer div using CSS

I am looking to create an outer div with horizontal scroll and inner div with vertical scroll where the inner div moves along with the outer div. <body> <div id="wrapper"> <div id="outer">content outer <div id="inner"&g ...

How can I execute the jQuery function using a button click?

There is a minimal use of jQuery in my code, where I have integrated jQuery with Django to achieve a particular functionality. In order to select the file, the following input field is used: <input id="chunked_upload" type="file" name="the_file"> ...

Some characters are not compatible with the CSS writing-mode feature

There seems to be an issue with the CSS writing mode not applying correctly to the symbol '№'. Here is an example: <html> <head></head> <body> <p style="writing-mode: vertical-lr;"> Номер № ...

Restoring hover functionality after resetting color using jQuery - tips and tricks

My jQuery code is working well, but I am facing one issue. After clicking on my infocontent menu, the hover effect on h1 is no longer working. How can I bring back the hover function? Here is the HTML: <div class="infocontent"><h1>What?</h ...