Linked Questions

Popular Questions

How to change text (not text size) as per window size in angular?

Asked by At

I want to show summary of text as per window size in Angular.Means to show a fixed part of whole paragraph as per window size.
I was using custom pipes to manually fixed the size of content visible on screen

<p> {{ text | summary:50 }}

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'summary'
 })
 export class SummaryPipe implements PipeTransform {

transform(value: string, limit?: number) {
    if (!value) { return null; }

    const actuallimit = (limit) ? limit : 50;
    return value.substr(0, actuallimit) + '...';
}
}

So instead of this fixed parameter (like 50 ) , I want to pass parameter based on window size.

How can I do this ?

Related Questions