fix: use ng searchparams
use ng ActivatedRoute replacing window.location.search
This commit is contained in:
@@ -23,10 +23,12 @@ export class AppComponent implements OnInit {
|
|||||||
constructor(private activatedRoute: ActivatedRoute){}
|
constructor(private activatedRoute: ActivatedRoute){}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
//TODO consider using Angular's ActivatedRoute here instead
|
this.activatedRoute.queryParams.subscribe(params => {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const names = params['names']?.replaceAll(',', '\n');
|
||||||
const names = params.get('names')?.replaceAll(',', '\n');
|
if (names) {
|
||||||
if (names) this.playerNamesValue = names;
|
this.playerNamesValue = names;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onButtonGenerate(textinput: string): void{
|
onButtonGenerate(textinput: string): void{
|
||||||
|
|||||||
Reference in New Issue
Block a user