Skip to content

Instantly share code, notes, and snippets.

@jbro-io
Last active March 1, 2018 04:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbro-io/4693374 to your computer and use it in GitHub Desktop.
Save jbro-io/4693374 to your computer and use it in GitHub Desktop.
This is a Visualforce component used to render Knockout.js HTML comment tags.
<apex:component layout="none">
<apex:attribute name="statement"
description="The Knockout containerless statement to insert."
type="String"
required="false"
/>
<apex:attribute name="close"
description="Flag that determines whether this is an opening or closing statement for Knockout."
type="Boolean"
required="false"
default="false"
/>
<apex:componentBody>
<!--knockout opening tag-->
<apex:outputPanel layout="none" rendered="{!NOT(ISBLANK(statement))}">
<apex:outputText value="<" escape="false"/>!-- ko {!statement} --<apex:outputText value=">" escape="false"/>
</apex:outputPanel>
<!--knockout closing tag-->
<apex:outputPanel layout="none" rendered="{!close}">
<apex:outputText value="<" escape="false"/>!-- /ko --<apex:outputText value=">" escape="false"/>
</apex:outputPanel>
</apex:componentBody>
</apex:component>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment