import { Component, OnInit, NgZone } from '@angular/core';
-import { ActivatedRoute } from '@angular/router';
+import { ActivatedRoute, Router } from '@angular/router';
import { ChatroomService } from "../chatroom.service";
import { UserService } from "../user.service";
import { Chatroom } from "../chatroom";
messages: Message[] = [];
constructor(
+ private router: Router,
private chatroomsService: ChatroomService,
private userService: UserService,
private route: ActivatedRoute,
const id: string | null = this.route.snapshot.paramMap.get('id');
if (id === null) {
console.log("ID for chatroom is missing in URI");
+ this.router.navigate(['chatrooms']);
}
else {
this.chatroomsService