import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'slug' } ) export class SlugPipe implements PipeTransform { transform ( title ) { const urlSlug = title . trim ( ) . toLowerCase ( ) . replace ( / /g , '-' ) ; return urlSlug ; } }