-1
Some way to implement a Canactivate loading in Angular 11?
import { NgModule } from '@angular/core';
import { AngularFireAuthGuard, redirectUnauthorizedTo } from '@angular/fire/auth-guard';
import { RouterModule, Routes } from '@angular/router';
import { ListaComponent } from './lista/lista.component';
import { MensagemComponent } from './mensagem/mensagem.component';
const redirectUnauthorizedToLogin = () => redirectUnauthorizedTo(['/login']);
const routes: Routes = [
{
path: '',
redirectTo: 'lista',
pathMatch: 'full'
},
{
path: 'lista',
component: ListaComponent,
canActivate: [ AngularFireAuthGuard ],
data: { authGuardPipe: redirectUnauthorizedToLogin }
},
{
path: 'mensagem',
component: MensagemComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class ViewsRoutingModule { }
Interesting... I’ll take a look but I think it’s going to meet with what I need. Thank you
– Ezequiel Tavares