Gravatar for

Question by jpdery, Jun 25, 2014 2:04 PM

ResultFolding data-result-template-selector causes "Uncaught [Object object]"

Does not seem to work, or I don't know how to "adding a template directly in your HTML page and by passing the id attribute of this template".


using attribute data-result-template-selector="#TranslatedContentChildResult", I get JavaScript "Uncaught [Object object]"

My template is simply declared in my html as :

< script id="TranslatedContentChildResult">
              <div class="coveo-title">
                  <a class="CoveoResultLink">zzz<%=Title?highlight(Title, titleHighlights):ClickUri%></a>
            < /script>
1 Reply
Gravatar for

Answer by olamothe, Jun 25, 2014 2:11 PM

Add the type text/x-underscore-template to your template script, so that the framework knows it's a result template.

 <script src="path/to/jssearch.dependencies.js" />
 <script id="TranslatedContentChildResult"  type="text/x-underscore-template">
   [content of the template]
 <script >
   [init call]

   <div class="CoveoResultList">
        <script class="result-template" type="text/x-underscore-template">
               <div class='CoveoResultFolding'
Ask a question