#6 ⚙️Connect Database
Create custom pipes
We will add two custom pipes in our app
Excerpt: which will show a summary of post in blog card.
Slug: which will show the URL slug for a post.
We will create a a new pipe named ExcerptPipe. Right-click on the folder 📁custompipes
and then navigate to 'Angular Generator', select 'Pipe' and provide the name ‘excerpt.
Replace the transform
method in the file 📝 src/app/custompipes/excerpt.pipe.ts
with the following code :
Furthermor we create a slug pipe. Right-click on the folder 📁custompipes
and then navigate to 'Angular Generator', select 'Pipe' and provide the name ‘slug’.
Replace the transform
method in the file 📝 src/app/custompipes/slug.pipe.ts
with the following code:
Get the blogs from database
Last updated
Was this helpful?