Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have a Angular Application, in a main.js file i have defined the app routing but i have a doubt, for example, i have a accodion menu of bootstrap, when i click about the next button:

<a href="#MainMenu" data-toggle="collapse" data-parent="#MainMenu" class="dropdown-toggle"><img src="img/ico_menu_off.png" /></a>

Due to the angular's configuration routes, the atributte href="#MainMenu", it recognizes it as a route and I not want to do anything.

This is the js code:

angularRoutingApp.config(function($routeProvider) {
    $routeProvider
        .when('/', {
            templateUrl : 'pages/home.html',
            controller  : 'mainController'
        })
        .when('/customerSearch', {
            templateUrl : 'pages/customer-search.html',
            controller  : 'customerSearchController'
        })      
        .otherwise({
            redirectTo: '/'
        });
});

How could resolved this? thanks, (i'm new in Angular)

share|improve this question
1  
Did you set $locationProvider.html5Mode(true) in your app config? – Tom A 2 days ago

You shouldn't use href attribute to select accordion in your case, because it will change the URL directly as you are using anchor's href. To solve problem you should use data-target attribute instead of href

Markup

<a data-target="#MainMenu" data-toggle="collapse" data-parent="#MainMenu" class="dropdown-toggle">
   <img src="img/ico_menu_off.png" />
</a>
share|improve this answer

You can remove the href and open it with JavaScript on click:

$("#MainMenuTrigger").click(function(){
     $('#MainMenu').modal();
});

http://getbootstrap.com/javascript/#js-programmatic-api

I suggest you also to give a look to Angular UI Bootstrap.

share|improve this answer

you could remove hash from URL. find this URL it will help you http://www.codeproject.com/Tips/1063634/Removing-the-sharp-Sign-from-AngularJS-URLs-with-I

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.