<!--
  ============LICENSE_START==========================================
  ONAP Portal
  ===================================================================
  Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
  ===================================================================
 
  Unless otherwise specified, all software contained herein is licensed
  under the Apache License, Version 2.0 (the "License");
  you may not use this software except in compliance with the License.
  You may obtain a copy of the License at
 
              http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 
  Unless otherwise specified, all documentation contained herein is licensed
  under the Creative Commons License, Attribution 4.0 Intl. (the "License");
  you may not use this documentation except in compliance with the License.
  You may obtain a copy of the License at
 
              https://creativecommons.org/licenses/by/4.0/
 
  Unless required by applicable law or agreed to in writing, documentation
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
 
  ============LICENSE_END============================================
 
  
  -->
<!doctype html>
<html lang="en">
<head>
<script>
        __Zone_enable_cross_context_check = true;
        function nthIndex(str, pat, n) {
          var L = str.length, i = -1;
          while (n-- && i++ < L) {
            i = str.indexOf(pat, i);
            if (i < 0) break;
          }
          return i;
        }
        function addBaseHref(base) {
          //document.write("<base href='" + base + "' />");
          baseNode=document.createElement('base');
          baseNode.href=base;

          //document.getElementsByTagName('head')[0].appendChild(baseNode);
          var head = document.getElementsByTagName('head')[0];
          head.insertBefore(baseNode,head.childNodes[0] || null);
          window.base = base;
        }
       
          var base = window.location.pathname.substring(0, nthIndex(window.location.pathname,"/", 2) + 1);
          addBaseHref(base);

        
      </script>
  <meta charset="utf-8">
  <title>ONAP Portal</title>

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
  <app-root>Loading...</app-root>
  <script>
      __Zone_enable_cross_context_check = true;
      </script>
</body>
</html>
