Skip to content

Instantly share code, notes, and snippets.

@dasmido
Last active January 20, 2018 18:09
Show Gist options
  • Save dasmido/c99556902d1c3bfd235923b52333c5f8 to your computer and use it in GitHub Desktop.
Save dasmido/c99556902d1c3bfd235923b52333c5f8 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import {AuthService} from '../../services/auth.service';
import {Router} from '@angular/router';
import {FlashMessagesService} from 'angular2-flash-messages';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {
constructor(
private flashMessage: FlashMessagesService,
private authService: AuthService,
private router: Router) { }
ngOnInit() {
}
onLogoutClick(){
this.authService.logout();
this.flashMessage.show('You are logged out', {
cssClass: 'alert-success',
timeout: 5000
});
this.router.navigate(['/login']);
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment