post-detail.component.ts 570B

12345678910111213141516171819202122232425
  1. import { Component, OnInit } from '@angular/core';
  2. import { ActivatedRoute } from '@angular/router';
  3. import { IPost } from 'app/shared/model/post.model';
  4. @Component({
  5. selector: 'jhi-post-detail',
  6. templateUrl: './post-detail.component.html'
  7. })
  8. export class PostDetailComponent implements OnInit {
  9. post: IPost;
  10. constructor(private activatedRoute: ActivatedRoute) {}
  11. ngOnInit() {
  12. this.activatedRoute.data.subscribe(({ post }) => {
  13. this.post = post;
  14. });
  15. }
  16. previousState() {
  17. window.history.back();
  18. }
  19. }