Hi
If there possibility to display element which depents on function’s result?
Example:
<div class="btn-group" if.bind="mySpecialFunction()">
or
<div class="btn-group" if.bind="myOtherFunctionReturnsArray().length !== 0">
I don’t want to use boolean property
I see that function is executed only once, when view is builded.
I would like to execute it everytime, to conditional display element.
1 Like
Function calls in Aurelia template are treated as pure, which means they only get re-evaluated when their parameters change. So maybe do this:
<div class="btn-group" if.bind="mySpecialFunction(mySpecialVariable)">
And whenever mySpecialVariable
changes, if
value will be updated.
2 Likes
Thanks for answer.
I also have idea to use getter ( + computedFrom).
1 Like
This should be doc’d…
Also @jkowalski, you can optionally use the binding signaler (Binding: Binding Behaviors | Aurelia)
if.bind="mySpecialFunction() & signal:'someUpdate'"
But… Aurelia behind-the-scenes magic is probably being more efficient with mySpecialVariable
Kremnari
3 Likes