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