Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
~$*.pptx
node_modules
.idea
3 changes: 3 additions & 0 deletions itenium-socks/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@
}
}
}
},
"cli": {
"analytics": false
}
}
21 changes: 21 additions & 0 deletions itenium-socks/src/app/TemplatePageTitleStrategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Injectable } from "@angular/core";
import { RouterStateSnapshot, TitleStrategy } from "@angular/router";
import { Title } from "@angular/platform-browser";

@Injectable({ providedIn: 'root' })
export class TemplatePageTitleStrategy extends TitleStrategy {
constructor(private readonly title: Title) {
super();
}

private readonly default_title = "Toe-tally Amazing";

override updateTitle(routerState: RouterStateSnapshot) {
const title = this.buildTitle(routerState)
if (!title) {
this.title.setTitle(this.default_title);
} else {
this.title.setTitle(`${title} | ${this.default_title}`);
}
}
}
4 changes: 3 additions & 1 deletion itenium-socks/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, TitleStrategy } from '@angular/router';
import { provideHttpClient, withFetch } from '@angular/common/http';

import { routes } from './app.routes';
import { TemplatePageTitleStrategy } from "./TemplatePageTitleStrategy";

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideHttpClient(withFetch()),
{ provide: TitleStrategy, useClass: TemplatePageTitleStrategy },
]
};
2 changes: 1 addition & 1 deletion itenium-socks/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const routes: Routes = [
path: '',
component: LayoutComponent,
children: [
{ path: 'why-us', component: WhyUsComponent },
{ path: 'why-us', component: WhyUsComponent, title: "Why Us" },
{ path: 'socks', component: ShopComponent },
{ path: 'socks/:id', component: SockComponent },
]
Expand Down
1 change: 0 additions & 1 deletion itenium-socks/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Toe-tally Amazing</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.png">
Expand Down