我在drupal 7中创建了两个角度应用程序,如"example.com“、"example.com/app1”、"example.com/app2“。
example.com是我的主要网站。因此,当我将html5推态功能设置为删除角应用程序中的散列时,我没有从angularjs中得到任何基本错误。因为,
<base href="">需要启用angularjs html5推态。
我的问题是,由于我在这个drupal站点中有多个angualr应用程序,我如何动态地为"/app1“和"app2”添加条件基url?
有人能帮我吗?等待回应。谢谢。
发布于 2016-03-01 14:28:06
您可以通过以下方式向站点添加基本元素:
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');
}把它放进你的template.php
https://stackoverflow.com/questions/35719674
复制相似问题