Dynamic base url with angularjs 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,

&lt;base href=""&gt;


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.
Add base element to your sites theme template file:

YOUR_THEME_NAME_preprocess_html(&amp;$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' =&gt; 'base',
      '#attributes' =&gt; array(
      'href' =&gt; $url,
      ),
    );
    drupal_add_html_head($data, 'base_href');
}


Put it into your template.php

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