6.3: Using Alertify in Components
constructor(private _alertify: AlertifyService) { }NavComponent
login() {
this.authService.login(this.model).subscribe(data => {
this._alertify.success('Logged in successfully'); // <--- changed
}, error => {
this._alertify.error('Failed to login.'); // <--- changed
}, () => {
this.router.navigate(['members']);
});
}
logout() {
this.authService.userToken = null;
localStorage.removeItem('token');
this._alertify.success('Logged out'); // <--- changed
this.router.navigate(['/home']);
}RegisterComponent
Testing Alertify Messages




Last updated