Skip to content

Instantly share code, notes, and snippets.

@stefansheva
Created April 19, 2020 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefansheva/c1bebf8a3750add2e12485ebf7c8d7b8 to your computer and use it in GitHub Desktop.
Save stefansheva/c1bebf8a3750add2e12485ebf7c8d7b8 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import { PostService } from 'src/services/post.service';
@Component({
selector: 'app-post',
templateUrl: './post.component.html',
styleUrls: ['./post.component.scss']
})
export class PostComponent implements OnInit {
posts: any = [];
constructor(private postSvc: PostService) { }
ngOnInit() {
this.postSvc.getAllPosts().subscribe(res => {
this.posts = res;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment