Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 15031be

Browse files
change:Update overall Styling.
1 parent d245a3a commit 15031be

File tree

3 files changed

+28
-9
lines changed

3 files changed

+28
-9
lines changed

‎src/app/app-routing.module.ts‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ import {RegisterComponent} from "./component/register/register.component";
55
import {AuthenticatedComponent} from "./component/authenticated/authenticated.component";
66
import {AuthGuard} from "./guards/auth.guard";
77

8-
9-
10-
11-
128
const routes: Routes = [
13-
{ path: 'login', component: LoginComponent },
14-
{ path: 'signup', component: RegisterComponent },
15-
{ path: 'dashboard', component: AuthenticatedComponent , canActivate: [AuthGuard]}
9+
{ path: 'login', component: LoginComponent,data: {title: 'Login'} },
10+
{ path: 'signup', component: RegisterComponent,data: {title: 'Register'} },
11+
{ path: 'dashboard', component: AuthenticatedComponent,data: {title: 'Dashboard'} , canActivate: [AuthGuard]}
1612
];
1713

1814
@NgModule({

‎src/app/app.component.ts‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
11
import { Component } from '@angular/core';
2+
import {ActivatedRoute, NavigationEnd, Router} from "@angular/router";
3+
import {Title} from "@angular/platform-browser";
24

35
@Component({
46
selector: 'app-root',
57
templateUrl: './app.component.html',
68
styleUrls: ['./app.component.css']
79
})
810
export class AppComponent {
9-
title = 'Auth-angular-app';
11+
title = 'angular authentication System';
12+
constructor(
13+
public _router: Router,
14+
private activatedRoute: ActivatedRoute,
15+
private titleService: Title,
16+
) {
17+
}
18+
private getPageTitle(route: ActivatedRoute): string {
19+
while (route.firstChild) {
20+
route = route.firstChild;
21+
}
22+
return route.snapshot.data['title'] || ''; // Set a default title if not provided
23+
}
24+
25+
ngOnInit() {
26+
this._router.events.subscribe(event => {
27+
if (event instanceof NavigationEnd) {
28+
const pageTitle = this.getPageTitle(this.activatedRoute);
29+
this.titleService.setTitle(`${pageTitle} - ${this.title}`);
30+
}
31+
});
32+
}
1033
}

‎src/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>AuthAngularApp</title>
5+
<title>Angular authentication System</title>
66
<base href="/">
77
<meta name="viewport" content="width=device-width, initial-scale=1">
88
<link rel="icon" type="image/x-icon" href="favicon.ico">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /