title: Error: No provider for RouterStateSnapshot when using with CanLoad guard in Angular 4
body: <p>I am trying to redirect the users to login page, if the user isn't logged in. Once the user logs, I want to take the user back to the previous page. But I am getting an error as <code>StaticInjectorError[RouterStateSnapshot]: NullInjectorError: No provider for RouterStateSnapshot!</code>.</p>
  
  <p>Here's the code for the CanLoad functionality:</p>
  
  <pre><code>@Injectable()
  export class TokenGuardService implements CanLoad {
    constructor(private authService: AuthService, private router: Router, private snapshot: RouterStateSnapshot) {}
  
    canLoad(route: Route): Observable&lt;boolean&gt; | Promise&lt;boolean&gt; | boolean {
        if(this.authService.doesTokenExist()) {
          return true;
        } else {
          this.router.navigate(['/login'], { queryParams: { returnUrl: this.snapshot.url }});
          return false;
        }
    }
  </code></pre>
  
  <p>and here's the code my Component</p>
  
  <pre><code>export class LoginComponent implements OnInit {
  constructor(private loginService: LoginService, private router: Router, private route: ActivatedRoute) { }
  ngOnInit() {
      this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/dashboard';
    }
  
  onLoginFormSubmit() {
  //Some success scenario
  if(success) {
     this.router.navigate([this.returnUrl]);
    }
  }
  </code></pre>
  
  <p>Please help me resolve this issue.</p>