Trying to show MatDialog
in my Angular page when the user inputs wrong username and password combination, instead I get one that shows my login page itself.
See Image below:
Dialog
Here is what I have tired in the LoginComponent:
login() : void {
const dialogConfig = new MatDialogConfig();
this.utilisateurService.getLogin(this.username,this.password).subscribe((util: UtilisateurModel) => {
this.utilisateur = util;
if(util)
{
this.router.navigate(["home"]);
}
else
{
dialogConfig.disableClose = true;
dialogConfig.autoFocus = true;
dialogConfig.data = {
id: 1,
title: 'Désolé, nom d\'utilisateur ou mot de passe non reconnu.'
};
this.dialog.open(LoginComponent, dialogConfig);
}
});
}
I tried this answer by adding entryComponents
in the @NgModule
of app.module.ts
but with no changes:
providers: [],
bootstrap: [AppComponent],
entryComponents: [
LoginComponent
]
Thank you in advance