import { SetDataService } from "../../../service/set-data.service";
import { Router } from "@angular/router";
import { Component, OnInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router";
import { HelperService } from "app/service/helper.service";
import { AnnounceData } from "app/data/AnnounceData";
import { BoardDataService } from "app/service/board-data.service";

@Component({
  selector: "app-board001-view-board",
  templateUrl: "./board001-view-board.component.html"
})
export class Board001ViewBoardComponent implements OnInit {
  errorMessage: String;
  data: any;
  announceData: AnnounceData;

  selectedItem: any;
  itemId: number;
  loading = false;

  constructor(
    private boardDataService: BoardDataService,
    private route: ActivatedRoute,
    private router: Router,
    private helperService: HelperService
  ) {}

  ngOnInit() {
    this.loading = true;
    this.announceData = new AnnounceData();
    this.route.data.subscribe((data: { selectedItem: any }) => {
      this.loading = false;
      this.selectedItem = data.selectedItem;
    });
  }

  backPreviousPage() {
    this.router.navigateByUrl("/board/board001");
  }
}
