Hi Mario
My first hint is: Understand the freemarker [i]${myObject} expression[/i] :-)
It is similar to the [i]#toString[/i] method in Java.
Simply said freemarker applies #toString to the object (myObject).
When you pass the typical [i]content[/i] object (which is of [i]type
info.magnolia.jcr.util.ContentMap[/i]), freemarker will render the name of the
node.
When you pass a[i] javax.jcr.Node [/i]- which you get with
[i]cmsfn.asJCRNode(content)[/i]
freemarker renders the path of the node.
However, I think you want to pass to your angular snippet rather a property of
your page node, e.g. the title.
You can do something like this:
[code]
[#assign title=content.title!content.@path]
<div ng-controller="someController">
<div style="display: none">{{myVar='${title}'}}</div>
</div>
[/code]
If your prefer the title of the rootNode:
[code]
[#assign rootPageNode = cmsfn.root(content, "mgnl:page")!]
[#if rootPageNode??]
[#assign title=rootPageNode.title!rootPageNode.@path]
[#else]
[#assign title=content.title!content.@path]
[/#if]
[#-- Note that rootPageNode could be null, if you area öready on a "root level
page" --]
<div ng-controller="someController">
<div style="display: none">{{myVar='${title}'}}</div>
</div>
[/code]
Some links for you:
- http://freemarker.org/docs/ref_builtins_string.html
-
https://documentation.magnolia-cms.com/display/DOCS/Templating+function+arguments+and+return+types
I hope this helps :-)
Cheers,
Christoph
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=c2c6fa91-516f-485b-aaaa-e560cb343361
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------