Advertisement
kklevi

postcomponent1

May 29th, 2023
852
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Component, OnInit} from '@angular/core';
  2. import {Post} from "../../_models/post";
  3. import {PostService} from "../../post.service";
  4.  
  5. @Component({
  6.   selector: 'app-list-posts',
  7.   templateUrl: './list-posts.component.html',
  8.   styleUrls: ['./list-posts.component.scss']
  9. })
  10. export class ListPostsComponent implements  OnInit{
  11.  
  12.   subjectId:string=''
  13.   posts: Post[]
  14.   constructor(private postService: PostService, posts:Post[], subjectId:string) {
  15.     this.posts=[];
  16.   }
  17.  
  18.   ngOnInit(): void {
  19.     this.postService.getPosts(this.subjectId)
  20.   }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement