add pageTitle input

This commit is contained in:
rr-bw 2024-04-25 09:18:16 -07:00
parent 090d37ed54
commit a2efff82b9
No known key found for this signature in database
GPG Key ID: 3FA13C3ADEE51D5D
3 changed files with 24 additions and 8 deletions

View File

@ -197,12 +197,20 @@ const routes: Routes = [
children: [
{
path: "sample-route",
component: LoginComponent, // replace with your component
},
{
path: "",
component: HintComponent, // just an example that shows secondary content. Replace with your component (or remove this secondary outlet entirely if not needed)
outlet: "secondary",
children: [
{
path: "",
component: LoginComponent, // replace with your component
},
{
path: "",
component: HintComponent, // just an example that shows secondary content. Replace with your component (or remove this secondary outlet entirely if not needed)
outlet: "secondary",
},
],
data: {
pageTitle: "The Page Title",
},
},
],
},

View File

@ -1,4 +1,6 @@
<auth-anon-layout>
<!-- <div *ngIf="routeData$ | async as routeData"> -->
<auth-anon-layout [title]="pageTitle">
<router-outlet></router-outlet>
<router-outlet slot="secondary" name="secondary"></router-outlet>
</auth-anon-layout>
<!-- </div> -->

View File

@ -1,5 +1,5 @@
import { Component, OnDestroy, OnInit } from "@angular/core";
import { RouterModule } from "@angular/router";
import { ActivatedRoute, RouterModule } from "@angular/router";
import { AnonLayoutComponent } from "./anon-layout.component";
@ -9,6 +9,12 @@ import { AnonLayoutComponent } from "./anon-layout.component";
imports: [AnonLayoutComponent, RouterModule],
})
export class AnonLayoutWrapperComponent implements OnInit, OnDestroy {
pageTitle: string;
constructor(private route: ActivatedRoute) {
this.pageTitle = this.route.snapshot.firstChild.data["pageTitle"];
}
async ngOnInit() {
document.body.classList.add("layout_frontend");
}