I have a textbox and an image. When the user inserts text into the textbox I want to change the image shown. My doubt is how to do this in a MVVM way and in a "clean" way (following best practices).
<textbox id="searchTextbox" onChanging="@command('search')"/>
<image id="searchImage" src="/img/textbox/search-icon.png" ca:blueeyename="searchImage" />
The way I have to achieve this seems to me to be "cumbersome": change image to:
<image id="searchImage" src="@load(vm.imageSrc)" ca:blueeyename="searchImage" />
and then in my viewModel I have the "imageSrc" variable. On my "search" command I change the imageSrc variable to the correct value.
My solution seems a bit ugly as I have to create a variable on my ViewModel. I would expect to achieve all this on my .zul file.
Any way to do this in a cleaner way?