You are here

function angularjs_preprocess_html in AngularJS 7

Implements hook_preprocess_html

Adds <base> tag and sets ng-app attribute if provided

File

./angularjs.module, line 288

Code

function angularjs_preprocess_html(&$vars) {
  $app_name = angularjs_get_app_name();
  $base_href = angularjs_get_base_href();
  if (FALSE === empty($app_name)) {
    $vars['attributes_array']['ng-app'] = $app_name;
    $vars['html_attributes_array']['ng-app'] = $app_name;
  }
  if (FALSE === empty($base_href)) {
    drupal_add_html_head(array(
      '#tag' => 'base',
      '#attributes' => array(
        'href' => $base_href,
      ),
    ), 'angularjs_base_href');
  }
}