import { Component, OnInit } from '@angular/core';
import {ResourceService} from "../../service/resource.service";
import {ActivatedRoute} from "@angular/router";
import {environment} from "../../../environments/environment";
import {Resource} from "../../model/resource";

@Component({
  selector: 'app-resource',
  templateUrl: './resource.component.html',
  styleUrls: ['./resource.component.css']
})
export class ResourceComponent implements OnInit {
  resource: Resource ={};
  imagePath = environment.baseUrl+"/resource/image";

  constructor(private resourceService:ResourceService, private route: ActivatedRoute) { }

  ngOnInit(): void {
    const id = this.route.snapshot.paramMap.get('id');
    // @ts-ignore
     this.resourceService.getResource(id).subscribe(data =>{
       this.resource =data;
     });

  }

}
