posts.component.ts - This is loaded in the router outlet in the AppComponent
PostsComponent {
posts: any = [
{
'id': 1,
'comment': 'Blah blah blah',
'is_liked': false,
'like_count' = 24,
},
{
'id': 2,
'comment': 'Yeah yeah yeah!',
'is_liked': false,
'like_count' = 24,
}
]
}
posts-controls.component.ts - This is the child of the FooterComponent
PostControlsComponent {
likePost('post_id'){
//What do I do here
}
}
If I run this method likePost(1); how do I update 'is_liked' to be 'true' and increment 'like_count' by 1 in the PostsComponent?