Ceejay
Ceejay

Reputation: 7267

How to avoid route when clicked on hash tag in AngularJS

I have link in tiny carousel in the page,and i am using AngularJS route concept to build Single Page App. tiny carousel uses anchor tag as buttons to slide the images.

                  <div class="carousel-controls-mini">
                      <a href="#myCarousel" data-slide="prev">&#60;</a>
                      <a href="#myCarousel" data-slide="next">&#62;</a>
                  </div>

but when i click the next button the page is redirecting to default page i.e /home.

script.js

            when('/home', {
                templateUrl: 'home.html',
            }).

            when('/unlimited', {
                templateUrl: 'license-unlimited.html',
            }).

            when('/my-licenses', {
                templateUrl: 'my-licenses.html',
            }).

            otherwise({
                redirectTo: '/home'
            });

How can i resolve this issue? need help

Upvotes: 0

Views: 123

Answers (1)

Zee
Zee

Reputation: 8488

Use data-target instead.

Change

<div class="carousel-controls-mini">
         <a href="#myCarousel" data-slide="prev">&#60;</a>
         <a href="#myCarousel" data-slide="next">&#62;</a>
</div>

to

<div class="carousel-controls-mini">
       <a href="" data-target="#myCarousel" data-slide="prev">&#60;</a>
       <a href="" data-target="#myCarousel" data-slide="next">&#62;</a>
</div>

Upvotes: 1

Related Questions