Deployment Angular: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(→Apache) |
|||
| Zeile 84: | Zeile 84: | ||
[https://medium.com/@anandshende1994/setting-base-href-dynamically-in-angular-6-b7fe824848cf https://medium.com/@anandshende1994/setting-base-href-dynamically-in-angular-6-b7fe824848cf] | [https://medium.com/@anandshende1994/setting-base-href-dynamically-in-angular-6-b7fe824848cf https://medium.com/@anandshende1994/setting-base-href-dynamically-in-angular-6-b7fe824848cf] | ||
== Apache == | == Apache HTTP == | ||
=== Links === | === Links === | ||
Version vom 12. Mai 2019, 14:08 Uhr
Noch in Bearbeitung
Als Multimodule Maven Project
Siehe dazu Multimodule Maven Project
Links
https://www.devglan.com/spring-boot/spring-boot-angular-deployment
Als Maven Dependency
<!-- copy the latest angularJS client from the repository into the war file -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-web-client</id>
<phase>process-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>at.or.kirner.archive</groupId>
<artifactId>angular-client</artifactId>
<version>${ui.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
webpack
Aktuell nicht verwendet
base-href
Da sich durch das Integrieren des Angular-Front-End in der WAR-Datei der Pfad ändert (z.B. 'http://10.0.0.100:8080/video-archive/archive-client') muss auch der Basispfad in Angular geändert werden.
Dazu im <head>-Abschnitt vom index.html <base href="/"> folgendermaßen anpassen:
<script>
if (window.location.port == 4200) {
document.write('<base href="/">');
} else {
document.write('<base href="/video-archive/archive-client/">');
}
window['base-href'] = window.location.pathname;
</script>
Und im Basis-Modul (z.B. 'app.module.ts') gehört APP_BASE_HREF angepasst:
import { APP_BASE_HREF } from '@angular/common';
...
@NgModule({
...
providers: [
{ provide: APP_BASE_HREF, useValue: window['base-href'] }
]
})
...
Links
https://medium.com/@anandshende1994/setting-base-href-dynamically-in-angular-6-b7fe824848cf
Apache HTTP
Links
https://angular.io/guide/deployment
Zurück zu Angular