Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
Does anyone know if it's possible to strip HTML from the Nested Content header?
My header is set to render the first 100 characters of a RTE (since that's the only property on the document type), but it outputs the paragraph tags:
Thanks in advance :-)
Try setting the label to something
{{ bodyText.replace(/(<([^>]+)>)/ig, "").substring(0,100) }}
assuming your property alias is bodyText.
Thanks a lot for your reply, Søren!
That was my thoughts exactly, but it gives me this in the console:
Not sure if it's possible to perform JS magic inside the angularjs brackets (?) Also tried with just {{ bodyText.innerText }} and {{ bodyText.text() }}, but no result :-)
Hi Bo,
Maybe this will help: https://www.codeexpertz.com/blog/angularjs/remove-html-tags-angularjs-using-user-defined-filters-example-and-demo
If the question is still relevant, here is the solution we're using in our projects:
{{!!BodyText ? (BodyText | ncRichText | limitTo:100).trim() + '…' : '<Empty Content>'}}
It appeared that this Angular filter is listed in "Nested Content" manual: https://our.umbraco.com/documentation/getting-started/backoffice/Property-Editors/Built-in-Property-Editors/Nested-Content/
Found out there is a 'truncate' filter also available (8.6+), so I'm using it like this:
<ComponentName>{{!!heading ? ': ' + (heading | ncRichText | truncate:true:150) : ''}}
'true' param says keep whole words - I think
150 - max length
dots (...) are added if the text is longer
This is a little better then previous answer, because here, the ending dots are only added when the text is too long.
Just this seems to work nicely:
{{text | ncRichText | truncate:true:100}}
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Remove HTML from Nested Content header
Hi all,
Does anyone know if it's possible to strip HTML from the Nested Content header?
My header is set to render the first 100 characters of a RTE (since that's the only property on the document type), but it outputs the paragraph tags:
Thanks in advance :-)
Try setting the label to something
{{ bodyText.replace(/(<([^>]+)>)/ig, "").substring(0,100) }}
assuming your property alias is bodyText.
Thanks a lot for your reply, Søren!
That was my thoughts exactly, but it gives me this in the console:
Not sure if it's possible to perform JS magic inside the angularjs brackets (?) Also tried with just {{ bodyText.innerText }} and {{ bodyText.text() }}, but no result :-)
Hi Bo,
Maybe this will help: https://www.codeexpertz.com/blog/angularjs/remove-html-tags-angularjs-using-user-defined-filters-example-and-demo
If the question is still relevant, here is the solution we're using in our projects:
It appeared that this Angular filter is listed in "Nested Content" manual: https://our.umbraco.com/documentation/getting-started/backoffice/Property-Editors/Built-in-Property-Editors/Nested-Content/
Found out there is a 'truncate' filter also available (8.6+), so I'm using it like this:
'true' param says keep whole words - I think
150 - max length
dots (...) are added if the text is longer
This is a little better then previous answer, because here, the ending dots are only added when the text is too long.
Just this seems to work nicely:
is working on a reply...