Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { ChatService } from "../chat.service";
  3. import { Router } from "@angular/router";
  4.  
  5. @Component({
  6. selector: 'app-login',
  7. templateUrl: './login.component.html',
  8. styleUrls: ['./login.component.css']
  9. })
  10. export class LoginComponent implements OnInit {
  11.  
  12. userName : string;
  13. loginFailed : boolean = true;
  14.  
  15. constructor(private chatService : ChatService,
  16. private router : Router) { }
  17.  
  18. ngOnInit() {
  19. }
  20.  
  21. onLogin() {
  22. this.chatService.login(this.userName).subscribe(succeeded => {
  23. console.log(succeeded);
  24. this.loginFailed = false;
  25. if(succeeded === true) {
  26. this.router.navigate(["/rooms"]);
  27. return;
  28. }
  29. });
  30. }
  31.  
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement