diff options
author | statta <statta@research.att.com> | 2020-07-16 14:23:01 -0400 |
---|---|---|
committer | statta <statta@research.att.com> | 2020-07-29 17:59:37 -0400 |
commit | e4a4b56799d773d033ae2ef57a19891cd384de32 (patch) | |
tree | 1b1da5b84cde408040e5fd2812e4d0f18f8c22de /ecomp-sdk/epsdk-app-os | |
parent | 5b557b51c6e41315ad48727340df8d3247154330 (diff) |
Dynamic context determination via basehref
Issue-ID: PORTAL-949
Change-Id: Ia30876f51edd4a48633769c5a01f3646ca7fb9b2
Signed-off-by: statta <statta@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-os')
-rw-r--r-- | ecomp-sdk/epsdk-app-os/ngappsrc/angular.json | 1 | ||||
-rw-r--r-- | ecomp-sdk/epsdk-app-os/ngappsrc/src/ngwelcome.html | 28 |
2 files changed, 27 insertions, 2 deletions
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/angular.json b/ecomp-sdk/epsdk-app-os/ngappsrc/angular.json index 02ce9452..64b13511 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/angular.json +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/angular.json @@ -12,7 +12,6 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "baseHref": "/ONAPPORTALSDK/", "outputPath": "dist", "index": "src/ngwelcome.html", "main": "src/main.ts", diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/ngwelcome.html b/ecomp-sdk/epsdk-app-os/ngappsrc/src/ngwelcome.html index d290b96f..b85e25d2 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/ngwelcome.html +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/ngwelcome.html @@ -39,9 +39,35 @@ <!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>Portal SDK</title> - <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> |