Read more

Heads up: Angular may break links to the current URL (e.g. when using ngInclude)

Dominik Schöler
March 23, 2016Software engineer at makandra GmbH

Angular's location provider stalls links to the current URL, i.e. window.location. As soon as the $location service is activated in an Angular app, it will intercept links. The click event handler is registered in $LocationProvider.$get().

Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot

The motivation is reasonable, as they want to keep the Browser history clean when Angular is controlling it. However, when Angular is NOT controlling your interaction with the browser history (i.e. you're just using Angular as JS sugar on your page), Angular will create the above issue as soon as you use anything that depends on the location service, e.g. ngInclude.

We do not currently know how to circumvent that.

Posted by Dominik Schöler to makandra dev (2016-03-23 16:34)