ncuillery / angular-breadcrumb

Generate a breadcrumb from ui-router's states
http://ncuillery.github.io/angular-breadcrumb/
MIT License
785 stars 183 forks source link

Unexpected behavior, Views are changing automatically. #168

Closed tpessegueiro closed 7 years ago

tpessegueiro commented 7 years ago

I have an issue that is happening in both IE and Firefox. On Chrome it is working as expected.

I have the following routing defined:

var app = angular.module('EmailSPGroupsApp', ["ngRoute"]);
app.config(function ($routeProvider) {
    $routeProvider
        .when("/GroupsView", {
            templateUrl: "GroupsView.html"
        })
        .when("/EmailsView", {
            templateUrl: "EmailsView.html"
        }).otherwise({ redirectTo: '/GroupsView' })
});

I have in my app a button to move to change my view, and it does it like this:

$scope.nextPage = function () {

  ....
        $location.path(location);
    };

Where location ="/EmailsView".

When I trigger nextPage , it changes the view, but after a few seconds it reverts automatically to the previous view. (On Firefox this is a lot quicker so it seems as if it is just refreshing the GroupsView.

I've experimented switching the views, leaving just a blank view and it continues to happen.

if you need more info, just let me know.

tpessegueiro commented 7 years ago

So I've discovered the issue, causing this.

the buttons that were triggering the methods nextPage() and prevPage(), were causing a postback.

So the solution was to simply add type="button" in the html and it works