#6 π Add Feed
Add a BlogCardComponent
Create a new blog card component. Therefore right-click on the folder πcomponents
and then navigate to 'Angular Generator', select 'Component' and provide the name 'blog-card'.
Open πsrc/app/components/blog-card.component.ts
and add the following imports
Inject the Blog Service in the constructor of BlogCardComponent
class as shown below.
Add a property to hold the current blog post.
Now we will create a method to get the blog post and invoke it inside ngOnInit
in πsrc/app/components/blog-card.component.ts
file.
Add the BlogCardComponent to the home page
We will display the blog card on home page. Open πsrc/app/components/home.component.html
and REPLACE what is there with the following HTML.
Open πsrc/app/components/home/home.component.scss
and add the following style definition inside it.
Last updated
Was this helpful?