Forum Discussion
cike,
did you find the way to do it inside javascript?
I need pretty much the same, and was not able to find the answer...
I have a custom component that needs to be plugged only using javascipt to another component after some script on a fly...
something like:
<#if !user.registered> <@liaAddScript> ;(function($){ $('.someClass').append(<@component id="custom-component>); console.log('Im not registered!'); })(LITHIUM.jQuery); </@liaAddScript> <#else> <@liaAddScript> ;(function($){ console.log('im in!!'); })(LITHIUM.jQuery); </@liaAddScript> </#if>
reading your comment, I probably can't do it, not sure if's the correct way to do.
However, the only way I need it's that way, using javascript...
Any ideas?
Hi irach15,
unfortunately, as nathan described in his former posts it is not possible to append a piece of content which is rendered by the @component notation.
For our case we find a solution which adds the pagination component via Freemarker. To handle the pagination we wrote some JavaScript which works with our component and community structure.
Regards,
Christian
- irach159 years agoMaven
cike,
actually, in my case I'm able to do it and it's possible ;-)
I'm adding one component inside another, both of them are custom components
<div> <div id="hottopics"></div> </div> <@liaAddScript> ;(function($){ // add another component var topics = $('#hottopics'); topics.append('<@component id="test-plug-to-js"></@component>'); console.log('i got through!'); })(LITHIUM.jQuery); </@liaAddScript>
the only trick is to strip-out white-spacing and line breaks in test-plug-to-js component.
Wrap your component in
<@compress single_line=true>...</@compress>
to get rid off line spacing
http://freemarker.org/docs/dgui_misc_whitespace.html
- cike9 years agoChampion
Related Content
- 4 years agoInactive User
- 7 months ago