eager_eval in a comet snippet

19 views
Skip to first unread message

Dan Gravell

unread,
Sep 28, 2017, 10:56:50 AM9/28/17
to Lift
I've got this:

<div class="container" data-lift="comet?type=AnActor">
    <div data-lift="embed?what=composable" />
</div>

I want to do this because I want to apply the composable.html to a CssSel elsewhere.

Adding eager_eval to the parent snippet:

<div class="container" data-lift="comet?type=AnActor&amp;eager_eval=true">
    <div data-lift="embed?what=composable" />
</div>

... didn't work (the area where composable should be was empty).

In the end I didn't externalise composable and used CssSels to grab the NodeSeq I wanted to re-apply, but I thought this might be of use to someone else.

Dan

Antonio Salazar Cardozo

unread,
Sep 28, 2017, 4:12:04 PM9/28/17
to Lift
Just to clarify, the issue ultimately was that the comet was fed the raw `<div data-lift="embed?...">` markup?
Thanks,
Antonio

Dan Gravell

unread,
Sep 29, 2017, 5:28:52 AM9/29/17
to Lift
I was trying to re-use some template XML in an external file. Normally, if this is within a snippet, you have to use eager_eval, correct? Otherwise the embed will not be evaluated, because it's outside-in, and the embed element was subject to some other CSS selector transformations (I neglected to say that in the previous post). The result was the embed didn't appear.

However, adding eager_eval to the comet parameters appeared to make no difference.

Dan

Antonio Salazar Cardozo

unread,
Oct 3, 2017, 12:06:16 PM10/3/17
to Lift
Gotcha. Yeah, I think the comet gets passed the raw HTML. You can still use `S.runTemplate`
to execute the template (which will run the embed), and then use that as your basis for bindings,
but it takes some hoop-jumping.
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages