0
I’m trying to redirect to the homepage after logging in, but the system won’t log in
Test code I made for demonstration is this:
ngOnInit() {
this.loginForm = new FormGroup({
login: new FormControl('', {validators: [Validators.required], 'updateOn': 'blur'}),
password: new FormControl('', {validators: [Validators.required]})
}, );
this.navigateTo = this.activedRoute.snapshot.params['to'] || '/estacao';
}
login() {
this.router.navigate(['/pagina'])
}
This is the button code
<button type="submit" class="btn btn-primary btn-block" [disabled]="loginForm.invalid" (click)
Follow an example in stackblits: here and here
Archive with the routes:
export const ROUTES: Routes = [
{path: '', component: LoginComponent},
{path: ':to', component: LoginComponent},
{
path: 'pagina',
component: SistemaComponent, // Layout diferente da página de login
children: [
{path: '', component: PaginaComponent}
]
}
]