IWI IWI - 7 days ago 5
AngularJS Question

AngularJS and Handlebars limit outputted string length

I am displaying a

<p></p>
with 2 handlebar templates inside and I would like to limit the string length of the first template
{{person.activeReferralsDate}}
to 12 characters. Is there a way to do that? I have seen a way to limit the length on an
<input>
as well as when there is only 1 variable output.

Code:

<p class="future-appointments-info-holder-text-secondary">
{{person.activeReferralsDate}} | {{person.activeReferralsTime}}
</p>


TL;DR - I want
{{person.activeReferralsDate}}
to be limited to 12 characters in output length

Answer

You can use limitTo

{{person.activeReferralsDate  | limitTo: 12 }} 

DEMO

Comments