Carousels don't work when using angularjs?

Ashane Alvis

I have made a responsive image slider using css. I did it by using this example http://bootsnipp.com/snippets/featured/responsive-thumb-preview-in-carousel-indicators. The sliders work automatically except when I click the carousel, instead of sliding the images, it goes to another page. How to stop this? is it because it is conflicting with angularjs?

Here the code:

<div id="thumbnail-preview-indicators" class="carousel slide" data-ride="carousel">

    <ol class="carousel-indicators">
        <li data-target="#thumbnail-preview-indicators" data-slide-to="0" class="active">
            <div class="thumbnail">
                <img class="img-responsive" src="../assets/images/abstract_wallpaper_1.png" />
            </div>
        </li>
        <li data-target="#thumbnail-preview-indicators" data-slide-to="1">
            <div class="thumbnail">
                <img class="img-responsive" src="../assets/images/435523.jpg" />
            </div>
        </li>
        <li data-target="#thumbnail-preview-indicators" data-slide-to="2">
            <div class="thumbnail">
                <img class="img-responsive" src="../assets/images/wallpaper-1356336.jpg" />
            </div>
        </li>
    </ol>
    <div class="carousel-inner">
        <div class="item slides active">
            <div class="slide-1"></div>
            <div class="container">
                <div class="carousel-caption">
                    <h1>Hi there! How was your day?</h1>
                    <p>This is the slide 1. Next --></p>
                    <p><a class="btn btn-lg btn-primary" href="#/" role="button">I'm Fine</a></p>
                </div>
            </div>
        </div>
        <div class="item slides">
            <div class="slide-2"></div>
            <div class="container">
                <div class="carousel-caption">
                    <h1>Welcome back! how do you do?</h1>
                    <p>This is slide 2. Moving on... </p>
                    <p><a class="btn btn-lg btn-primary" href="#/" role="button">Great! Thanks.</a></p>
                </div>
            </div>
        </div>
        <div class="item slides">
            <div class="slide-3"></div>
            <div class="container">
                <div class="carousel-caption">
                    <h1>You are back again! Need anything?</h1>
                    <p>This is slide 3. And the last one</p>
                    <p><a class="btn btn-lg btn-primary" href="#/" role="button">Yes peace :)</a></p>
                </div>
            </div>
        </div> 
    </div>
    <a class="left carousel-control" href="#thumbnail-preview-indicators" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
    <a class="right carousel-control" href="#thumbnail-preview-indicators" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>

This is the app.js.

'use strict'

var app = angular.module('myWeb',
    [
        'ngRoute'
    ]);
console.log('app');
app.config(['$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {
    $routeProvider
        .when('/',{
            templateUrl: 'home.html',
            controller: 'HomeController'
        });
    $routeProvider
        .when('/signup',{
            templateUrl: 'signup.html',
            controller: 'SignupController'
        });
    $routeProvider
            .when('/contact', {
                templateUrl: 'contact.html',
                controller: 'ContactController'
            });
    $routeProvider
        .when('/about',{
            templateUrl: 'about.html',
            controller: 'aboutController'
        });

    $routeProvider
    .when('/t-and-c-m',
    {
        activatetab: '#t-and-c-m'
    });

}]);

Do i need to configure in angularjs too, to work out this? Help would be appreciated as i'm a beginner to angularjs.

The css for the question as follows

#thumbnail-preview-indicators {
  position: relative;
  overflow: hidden;
}
#thumbnail-preview-indicators .slides .slide-1, 
#thumbnail-preview-indicators .slides .slide-2,
#thumbnail-preview-indicators .slides .slide-3 {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}
    #thumbnail-preview-indicators,
    #thumbnail-preview-indicators .slides,
    #thumbnail-preview-indicators .slides .slide-1, 
    #thumbnail-preview-indicators .slides .slide-2,
    #thumbnail-preview-indicators .slides .slide-3 {
      height: 480px;
    }

#thumbnail-preview-indicators .slides .slide-1{
    background-image: url(../assets/images/abstract_wallpaper_1.png);
}

#thumbnail-preview-indicators .slides .slide-2{
    background-image: url(../assets/images/435523.jpg);
}

#thumbnail-preview-indicators .slides .slide-3{
    background-image:url(../assets/images/wallpaper-1356336.jpg);
}

#thumbnail-preview-indicators .carousel-inner .item .carousel-caption {
  top: 20%;
  bottom: inherit;
}
#thumbnail-preview-indicators .carousel-indicators li,
#thumbnail-preview-indicators .carousel-indicators li.active {
  position: relative;
  width: 100px;
  height: 8px;  
}
#thumbnail-preview-indicators .carousel-indicators li > .thumbnail {
  position: absolute;
  top: 0;
  width: 100px;
  display: none;
  opacity: 0;
  left: 50%;
  margin-top: -80px;
  margin-left: -50px;
}
#thumbnail-preview-indicators .carousel-indicators li:hover > .thumbnail,
#thumbnail-preview-indicators .carousel-indicators li.active > .thumbnail {
  display: block;
  opacity: .8;
}
#thumbnail-preview-indicators .carousel-indicators li.active > .thumbnail:hover{
  opacity: 1;
}
@media screen and (max-width : 480px) {    
    #thumbnail-preview-indicators .carousel-indicators li,
    #thumbnail-preview-indicators .carousel-indicators li.active {
      width: 50px;
      height: 8px;
      position: relative;
    }
    #thumbnail-preview-indicators .carousel-indicators li > .thumbnail {
       width: 50px;
       left: 50%;
       margin-top: -50px;
       margin-left: -25px;
    }
}
Hieu Le

Bootstrap Carousel is not compatible with AngularJs due to their use of # within the next/prev buttons.

You can either try to rewrite the bootstrap code for carousel.js or use other projects like this: https://angular-ui.github.io/bootstrap/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why don't these agile carousels work properly in chrome?

From Dev

Angularjs Controllers Don't Work

From Dev

AngularJS animations don't work

From Dev

Angularjs Controllers Don't Work

From Dev

ngShow don't work as expected when using custom directive

From Dev

Why arrow functions don't work when using import/export

From Dev

AngularJS Ionic Directive don't work

From Dev

AngularJS templates don't work with Spring

From Dev

AngularJS, ng-show don't work when boolean changes value

From Dev

Slick.js appendarrows doesn't work for multiple carousels

From Dev

The comment /* */ don't work when a string include "*/"

From Dev

JFrame don't work when adding an Image

From Dev

Google charts don't work when uploaded

From Dev

Deletion of table using Hibernate don't work

From Dev

getTextBeforeCursor and getExtractedText don't work in Android Marshmallow when using popup menu

From Dev

AngularJS - one of my directives don't work, the others do?

From Dev

Why jquery UI sortable don't work on AngularJS templateURL?

From Dev

Crashlytics don't compile when using Jack

From Dev

AngularJS document.ready doesn't work when using ng-view

From Dev

AngularJS document.ready doesn't work when using ng-view

From Dev

AngularJS reevaluates bindings when I don't change anything in the scope

From Dev

Don't show null when concatenating strings in AngularJS

From Dev

Data don't display when I use controller - AngularJs

From Dev

Why don't all member variables need volatile for thread safety even when using Monitor? (why does the model really work?)

From Java

Why buttons don't work when embedded in a SwiftUI Form?

From Java

Buttons don't work when I place them outside the carousel

From Dev

Home and End keys don't work when popup created on page?

From Dev

Why don't some "for" commands work when the output is piped?

From Dev

When i copy a spreadsheet script/triggers don't work

Related Related

  1. 1

    Why don't these agile carousels work properly in chrome?

  2. 2

    Angularjs Controllers Don't Work

  3. 3

    AngularJS animations don't work

  4. 4

    Angularjs Controllers Don't Work

  5. 5

    ngShow don't work as expected when using custom directive

  6. 6

    Why arrow functions don't work when using import/export

  7. 7

    AngularJS Ionic Directive don't work

  8. 8

    AngularJS templates don't work with Spring

  9. 9

    AngularJS, ng-show don't work when boolean changes value

  10. 10

    Slick.js appendarrows doesn't work for multiple carousels

  11. 11

    The comment /* */ don't work when a string include "*/"

  12. 12

    JFrame don't work when adding an Image

  13. 13

    Google charts don't work when uploaded

  14. 14

    Deletion of table using Hibernate don't work

  15. 15

    getTextBeforeCursor and getExtractedText don't work in Android Marshmallow when using popup menu

  16. 16

    AngularJS - one of my directives don't work, the others do?

  17. 17

    Why jquery UI sortable don't work on AngularJS templateURL?

  18. 18

    Crashlytics don't compile when using Jack

  19. 19

    AngularJS document.ready doesn't work when using ng-view

  20. 20

    AngularJS document.ready doesn't work when using ng-view

  21. 21

    AngularJS reevaluates bindings when I don't change anything in the scope

  22. 22

    Don't show null when concatenating strings in AngularJS

  23. 23

    Data don't display when I use controller - AngularJs

  24. 24

    Why don't all member variables need volatile for thread safety even when using Monitor? (why does the model really work?)

  25. 25

    Why buttons don't work when embedded in a SwiftUI Form?

  26. 26

    Buttons don't work when I place them outside the carousel

  27. 27

    Home and End keys don't work when popup created on page?

  28. 28

    Why don't some "for" commands work when the output is piped?

  29. 29

    When i copy a spreadsheet script/triggers don't work

HotTag

Archive