1

I have create 2 angular app into drupal 7 like

"example.com" "example.com/app1" "example.com/app2" 

example.com is my main site. So, when I set html5 pushstate enable for removing hash in angular apps, I got nobase error from angularjs. Coz,

<base href=""> 

require for enable angularjs html5 pushstate.

My question is, since i have multiple angualr app in this drupal site, how can i dynamically add conditional base url for "/app1" and "app2" ?

anybody can help me? Waiting for response. Thanx.

1
  • nobody here to help me? Commented Mar 1, 2016 at 11:22

1 Answer 1

1

Add base element to your sites theme template file:

YOUR_THEME_NAME_preprocess_html(&$variables, $hook) { $url = 'default';// default url if($application1) {// your condition for app1 $url = 'app1'; } elseif($application2) {// your condition for app2 $url = 'app2'; } $data = array( '#tag' => 'base', '#attributes' => array( 'href' => $url, ), ); drupal_add_html_head($data, 'base_href'); } 

Put it into your template.php

Ref: https://stackoverflow.com/a/35725528/3770000

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.