Reputation: 345
How to display other partial than default.htm
in onRun
component method ?
have to test some stuff and display specific partial according to the result.
edit: Another important point is that one of these partials need specific data, so how to pass them
Upvotes: 0
Views: 143
Reputation: 187
You can simply check some condition in twig and then include the correct partial in your default.htm
. Example:
{% if __SELF__.someCondition %}
{% partial __SELF__ ~ '::file1' %}
{% else %}
{% partial __SELF__ ~ '::file2' %}
{% endif %}
Where someCondition
refers to either a member variable of your component or a method. You can even have more complex structures and check for certain values explicitly. Check out the twig documentation.
Upvotes: 3