For example if I had:
<a ic-get-from="/some-list">Get List</a>
where /some-list returns, say, this:
<ul>
<li class="my-item" data-id="1">One</li>
<li class="my-item" data-id="2">Two</li>
</ul>
How would I wire in something like:
$(".my-item").click(function(evt) { alert(evt.target.getAttribute("data-id");});
I've tried using the complete.ic and after.success.ic events and X-IC-Trigger but everything seems to run *before* the new elements are swapped in so jquery never attaches the click event... As far as I can see ic-action only works for jquery actions on the target element so I'm not sure that would work either.
I looked through the source and managed a quick workaround by adding this to the processICResponse function:
try {
doSwap();
target.trigger("swap_complete.ic", [target]);
} catch (e) {
log(elt, "Error during content swaop : " + formatError(e), "ERROR");
}
but obviously I'd rather not touch the actual intercooler source.
Like I said this is probably a dumb question - is there an idiomatic way of handling this case?
Really enjoying the library so far, thanks for coming up with something so simple!
--
You received this message because you are subscribed to the Google Groups "intercooler-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to intercooler-j...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.