I know this is probably how Angular works by design, but I would like to verify it with people who have a longer history with and better understanding of AngularJS.

What I'm trying to achieve
A site where Drupal is used for creating the site structure. Everything that can be cached, will be cached, so Drupal in a way serves static html.
In some sections, content will be loaded and displayed with Angular + Services REST.

I have already gotten the basic idea working.

The problem

  1. Angular interferes with site URL:s, so when i go to mysite.com/stuff, the url is changed back into mysite.com. The correct page is shown.
  2. Whenever I have my Angular app loaded within the page, contextual links (for configuring blocks and views) do nothing.
  3. Also, I am no longer able to open links from the admin bar to the admin overlay in a new tab because Angular takes over the URL handling.

Using $locationProvider.html5Mode does not seem to have an effect on the basic problem.

What I'm asking is
Does anyone know if there's a way of configuring Angular so that by default it does not change the url?
Is there a way of telling Angular "these hashbangs belong to you, don't mess with anything else"?
Or, is there a way of using Angular JS with internal states only, not interfering with URLs at all?

I am using Drupal 7.32, AngularJS module 7.x-1.3, and AngularJS 1.3.1 (which I updated myself to libraries)

Comments

KimmoT’s picture

Issue summary: View changes
KimmoT’s picture

Issue summary: View changes
JoshRickert’s picture

I faced some similar issues. In order to get Angular to stop interfering with the Drupal links I had to add a hash prefix to my AngularJS app. Something like this:

app.config(['$locationProvider',
  function($locationProvider) {
    $locationProvider.html5Mode(false).hashPrefix('!');
}]);

I am using Drupal to manage a few static pages, basic CMS functionality, user auth, etc. Then using Angular at mysite.com/app#!/ to do all the rich interactive stuff.

KimmoT’s picture

Thanks! I'll give that a try.