title: Why can't I log things in Angular guard?
body: <p>I have a Route protected by a Guard which doesn't work. And when I try to console.log for debugging nothing happens. What am I missing?</p>
  
  <p>Here's my app-routing.module.ts:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { RouterModule, Routes } from '@angular/router';
  import { ForetagsprofilComponent } from 
  import { UserHasJwtToken } from './guards/user-has-jwt-token.guard';
  
  const appRoutes: Routes = [
    {
      path: '',
      component: SearchForetagsprofilComponent
    },
    {
      path: 'redigera',
      component: ForetagsprofilComponent,
      canActivate: [UserHasJwtToken]
    }
  </code></pre>
  
  <p>And here's my guard user-has-jwt-token.guard.ts:</p>
  
  <pre><code>import { Injectable, OnInit } from '@angular/core';
  import { CanActivate, Router } from '@angular/router';
  import { AfUserService } from '../services/af-user-service';
  import { AfUserInfo } from '../model/af-user-info';
  
  @Injectable()
  export class UserHasJwtToken implements CanActivate, OnInit {
  
    private _afUserInfo = new AfUserInfo();
    constructor(private afUserService: AfUserService, private router: Router) {
    }
  
    ngOnInit(): void {
      this.afUserService.getUserInfo().subscribe(response =&gt; {
        this._afUserInfo = response;
      });
  
      console.log('Customernumber: ' + this.afUserService.getUserInfo());
    }
  </code></pre>