I have created custome summary pipe class it works fine but I want to add a read more link end of substring.. when clicked all content shown.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'summary' })
export class SummaryPipe implements PipeTransform {
transform(value: string, maxWords: number) {
if (value)
return value.substring(0, maxWords) +"... <a href='#' (click)='getAllText()'>Read more</a>";
}
getAllText() {
//return this.value; ?
}
}
I need to fill fucn I know but I need to ask what is more efficient and true way of accomplish this?