Change font size dynamically based on text length

I’m a beginner at angular, ionic and coding in general. How can I change the font size of a <p></p> dynamically so that when the text length is less than x , the font size is bigger but when the text length is greater than x the font size is fixed.

Like this example: http://jsfiddle.net/jfbrLjt2/ where they used jQuery.

A little example would be greatly appreciated. Thank you.

I’m trying to implement to the code below:

<p class="posttext" *ngIf="post.message">{{ post.message }}</p>  
.posttext{
  display: -webkit-box;
  max-width: 100%;
  height: 85px;
  font-size: 14px;
  line-height: 1;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-line;
  white-space: pre-wrap;

}

You could add a second class to your element using [ngClass] that shrinks the font when the text is at a certain length. https://angular.io/api/common/NgClass