title: Angular 9 Redirect if query param not provided
body: <p>I have a route that should only be accessible to a user when they click a link from an email and are redirected with a valid query parameter in the url. If the parameter is not provided, I want to redirect to a 404 page not found component, like follows.</p>
  
  <pre><code>this.route.queryParams.subscribe(params =&gt; {
        if (params.myParam) {
          //do something
        } else {
          // redirect to 404
        }
      })
  </code></pre>
  
  <p>The issue I have is that query params is initialized to an empty object in ngOnInit(). I have utilized rjxs to wait until the parameter is accessible like this</p>
  
  <pre><code>this.route.queryParamMap.pipe(
        filter(paramMap =&gt; paramMap.has('myParam')),
        map(paramMap =&gt; paramMap.get('myParam')),
        take(1)
      ).subscribe(myParam =&gt; doSomething(myParam));
  </code></pre>
  
  <p>But I'm not very well versed in rxjs operators, and now I'm stuck on how to actually redirect if  paramMap has finished initializing and the parameter isn't found.</p>