-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathapp.component.ts
More file actions
37 lines (36 loc) · 840 Bytes
/
app.component.ts
File metadata and controls
37 lines (36 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Component, inject } from '@angular/core'
import { NavigationEnd, Router, RouterOutlet } from '@angular/router'
import { filter } from 'rxjs/operators'
import { TopbarComponent } from './ui/components/topbar.component'
@Component({
selector: 'sp-app-root',
imports: [RouterOutlet, TopbarComponent],
styles: [
`
:host {
display: block;
width: 100%;
height: 100%;
}
:host > div {
padding-top: 54px;
width: 100%;
height: 100%;
}
`,
],
template: `
<sp-topbar></sp-topbar>
<div>
<router-outlet></router-outlet>
</div>
`,
})
export class AppComponent {
router = inject(Router)
constructor() {
this.router.events.pipe(filter((e) => e instanceof NavigationEnd)).subscribe(() => {
window.scrollTo(0, 0)
})
}
}