Trying to do something fairly simple I think and query a FeedItem record then display its body in a lightning component. Issue I have is that I cant work out how to display the body unescaped.
In the component as before I am even trying to fling in an escape = false attribute but isnt doing the trick.
(If this was visualforce Id use the escaped= false attribute on apex:output text but that doesnt seem to be availbe here).
Apex Controller Method
@AuraEnabled
public static FeedItem getChatterPost(Id parId) {
return [SELECT Id, Title, Body, Type, ParentId, Parent.Name
FROM FeedItem
WHERE ParentId = :parId
LIMIT 1];
}
Component
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" controller="PortalCaseAlertsController">
<ltng:require styles="/resource/SLDS203/assets/styles/salesforce-lightning-design-system-ltng.css" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<aura:attribute name="chatterPost" type="FeedItem" />
<aura:attribute name="chatterPostList" type="FeedItem[]" />
<article class="slds-card slds-card">
<div class="slds-card__header slds-grid">
<header class="slds-media slds-media--center slds-has-flexi-truncate">
<div class="slds-media__body slds-truncate">
<h2>
<a href="javascript:void(0);" class="slds-text-link--reset">
<span class="slds-text-heading--small">Announcements</span>
</a>
</h2>
</div>
</header>
</div>
<div class="slds-card__body slds-text-align--center">
<div class="uiOutputRichText" escape="false" linkify="true" >
{!v.chatterPost.Body}
</div>
</div>
<div class="slds-card__footer"> ... </div>
</article>
Output