Skip to content

Commit 30f0acd

Browse files
committed
refactor(app): add title service
1 parent d230e05 commit 30f0acd

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/app/app.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ describe('AppComponent', () => {
2020
expect(app).toBeTruthy();
2121
});
2222

23-
it(`should have as title 'CoreUI v4 Angular Admin Template'`, () => {
23+
it(`should have as title 'CoreUI Free Angular Admin Template'`, () => {
2424
const fixture = TestBed.createComponent(AppComponent);
2525
const app = fixture.componentInstance;
26-
expect(app.title).toEqual('CoreUI v4 Angular Admin Template');
26+
expect(app.title).toEqual('CoreUI Free Angular Admin Template');
2727
});
2828
});

src/app/app.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ import { Router, NavigationEnd } from '@angular/router';
33

44
import { IconSetService } from '@coreui/icons-angular';
55
import { iconSubset } from './icons/icon-subset';
6+
import { Title } from '@angular/platform-browser';
67

78
@Component({
89
// tslint:disable-next-line:component-selector
910
selector: 'body',
1011
template: '<router-outlet></router-outlet>',
1112
})
1213
export class AppComponent implements OnInit {
13-
title = 'CoreUI v4 Angular Admin Template';
14+
title = 'CoreUI Free Angular Admin Template';
1415

1516
constructor(
1617
private router: Router,
18+
private titleService: Title,
1719
private iconSetService: IconSetService
1820
) {
21+
titleService.setTitle(this.title);
1922
// iconSet singleton
2023
iconSetService.icons = { ...iconSubset };
2124
}

src/app/app.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { HashLocationStrategy, LocationStrategy, PathLocationStrategy } from '@angular/common';
3-
import { BrowserModule } from '@angular/platform-browser';
3+
import { BrowserModule, Title } from '@angular/platform-browser';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55
import { ReactiveFormsModule } from '@angular/forms';
66

@@ -95,7 +95,8 @@ const APP_CONTAINERS = [
9595
provide: PERFECT_SCROLLBAR_CONFIG,
9696
useValue: DEFAULT_PERFECT_SCROLLBAR_CONFIG,
9797
},
98-
IconSetService
98+
IconSetService,
99+
Title
99100
],
100101
bootstrap: [AppComponent],
101102
})

0 commit comments

Comments
 (0)