Hi Team,
I am trying to use dynamic UI composition where I need to show or hide a composed element based on the expression (line number 20 in welcome.ts)in the JSON property. No luck. Please help.
Hi Team,
I am trying to use dynamic UI composition where I need to show or hide a composed element based on the expression (line number 20 in welcome.ts)in the JSON property. No luck. Please help.
I think you’ll need to use eval, like this:
show.two-way="!eval(item.show)"
Although using eval is almost always a bad idea.
Thanks for responding, no luck with eval again. Trying with Parser from aurelia-binding, still struggling.
I am referring the below one
Hi @ashley ,
I have followed your blog for solving this. DynamicExpressionBindingBehavior saved me.
Thank you.
Hi Team,
I am facing another problem, when the expression has a method call it is not updating. Please Help
for example:
show: "questions[2].answer.indexOf(‘日産’) >= 0"
Line 37 below
what do you expect to be updated in this scenario? The parameter passed to the method indexOf
is a literal string, means it will never change, so it shouldn’t update right?
Let me share the exact use case and sample code with you for better understanding. Thanks for your support.
Hi @bigopon,
Use case:
I was able to make it work here https://codesandbox.io/s/nostalgic-khorana-92uc0
There’s 2 key changes:
questions[2].answer
, as the mutation of that won’t trigger changes in the expression questions[2].answer.indexOf('Nissan')
. To overcome this, I added an noop value converter to basically observe the array questions[2].answer
, there’s other way to do it too.Edit: you can also change the && questions[2].answer &&
to && questions[2].answer.length &&
so it can observe everything properly
@bigopon, Thank you very much for helping me. Learing new things, day by day.
Thank you,
Praveen Gandhi.