Skip to content

fix(app): missing event.preventDefault #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2015
Merged

fix(app): missing event.preventDefault #683

merged 1 commit into from
Jun 16, 2015

Conversation

corburn
Copy link
Contributor

@corburn corburn commented Nov 4, 2014

This PR adds event.preventDefault() to the $on('$stateChangeStart) Auth intercept because it fixed an intermittent bug in my code.

I made the following change in my code:

// Before:
if (next.authenticate && !loggedIn) {
    $location.path('/login');
}

// After
if (!loggedIn && next.name !== 'login') {
      event.preventDefault();
      $state.go('login');
}

Before adding event.preventDefault(), the state intercept would intermittently fail to redirect the user to the login view. Specifically when clicking links. Adding event.preventDefault() fixed the problem.

Awk34 added a commit that referenced this pull request Jun 16, 2015
fix(app): Add event.preventDefault to login redirect
@Awk34 Awk34 merged commit f6f912f into angular-fullstack:master Jun 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants