I am currently developing a project in Angular 4 and have encountered an issue with passing login information to the next state upon successfully changing states. In AngularJS, we could achieve this using stateParams
, but I'm unsure of how to implement it in Angular 4. Can anyone guide me on how to accomplish this in Angular 4?
Here's the code snippet I'm working with:
import { Component, OnInit } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Router } from '@angular/router';
// Other imports...
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
constructor(private router: Router, private http: Http) { }
signup(){
this.router.navigate(['register']);
}
createAuthorizationHeader(headers: Headers) {
// Authorization logic here...
}
onSubmit(userForm: NgForm){
// Form submission logic here...
}
ngOnInit() {
}