-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathapp.component.ts
More file actions
26 lines (24 loc) · 783 Bytes
/
app.component.ts
File metadata and controls
26 lines (24 loc) · 783 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
import { Component, OnInit, inject } from '@angular/core';
import { NavbarComponent } from './components/navbar/navbar.component';
import { RouterOutlet, ActivatedRoute } from '@angular/router';
import { PubsubService } from './services/pubsub.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: true,
imports: [NavbarComponent, RouterOutlet]
})
export class AppComponent implements OnInit {
title = 'webapp';
private route = inject(ActivatedRoute);
private pubsub = inject(PubsubService);
ngOnInit(): void {
this.route.queryParamMap.subscribe(params => {
const host = params.get('host');
if (host) {
this.pubsub.setHost(host);
}
});
}
}