When working in a .ts file, you can set up query parameters like this:
private queryParams:string ='';
ngOnInit() {
this.route.queryParams.subscribe(params => {
this.queryParams= params['parameterName'];
});
}
To clarify, if the route is "/userId" the code should look like this:
this.queryParams= params['userId'];
When working in a .html file, you can use the following code snippet to check for specific query parameter values:
<div *ngIf="queryParams.toLowerCase() === 'queryName'.toLowerCase()"></div>
For example, if the intended string is "userName," the code would look like this:
<div *ngIf="queryParams.toLowerCase() === 'userName'.toLowerCase()"></div>