How to provide dynamic value for "href" attribute and include if..else.. blocks in html file

28 views
Skip to first unread message

bvenkatr

unread,
Jun 21, 2014, 12:57:48 AM6/21/14
to mont...@googlegroups.com
Hi,
Good morning,

I have few questions, may be which are very basic but I am struggling for the last two days.

Q1) How can I provide href value for anchor tag when it comprises img tag? Here href value comes from the server side.
 That is ..,
<ul data-montage-id="results" class="media-list">
  <a data-montage-id="link" class="pull-left"><img data-montage-id="image" class="media-object" width="128" height="128" alt="image is in progress " /></a>
</ul>

My serialization object is

"results": {
            "prototype": "montage/ui/repetition.reel",
            "properties": {
                "element": {"#": "results"},
                "isSelectionEnabled": true
            }
        },
"image": {
            "prototype": "digit/ui/image.reel",
            "properties": {
                "element": {"#": "image"}
            },
            "bindings": {
                "src": {"<-": "@results:iteration.object.result.imageurl"}
            }
        },
"link": {
"prototype": "matte/ui/anchor.reel",
"properties": {
"element": { "#": "link" },
        "href": "http://montagejs.org"
}
}

According to above code, image has not shown on the UI. 
Q2) If I provide/hard code href attribute at anchor tag itself( not via serialization object), How can I dynamically update that href value ?
Q3) How can I include if.. else.. blocks in html file ? According to result's I need to display block of code at a time.

Thanks in advance,
Any help would be appreciated.




Reply all
Reply to author
Forward
0 new messages