Snippets are lazily evaluated, which means that the Inner
snippet will not be invoked until the Outer
snippet is evaluated. By using this neat feature, we can nest snippet invocations in our HTML templates, and thus gain a powerful tool to dynamically generate HTML with a fine-grained control. For example, you can use this feature to show different things to your users depending on whether they are logged in or not and on their authorization level. We'll learn how to do this in this recipe.
Create a new project and add the following designer-friendly HTML code into the index.html
file to invoke the snippet and trigger all of the mechanisms to render snippets recursively:
<div data-lift="Outer.choose"> <div class="inner-div"></div> </div>