Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { ChatService } from "../chat.service";
- import { Router } from "@angular/router";
- @Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.css']
- })
- export class LoginComponent implements OnInit {
- userName : string;
- loginFailed : boolean = true;
- constructor(private chatService : ChatService,
- private router : Router) { }
- ngOnInit() {
- }
- onLogin() {
- this.chatService.login(this.userName).subscribe(succeeded => {
- console.log(succeeded);
- this.loginFailed = false;
- if(succeeded === true) {
- this.router.navigate(["/rooms"]);
- return;
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement