Created
April 19, 2020 12:53
-
-
Save stefansheva/c1bebf8a3750add2e12485ebf7c8d7b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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