You need to sign in to do that
Don't have an account?
Narender Kumar
Trouble in replace image src
Hello Everyone,
I want to change image src in lightning component from lightning controller.
But with cmp.find("imgid") not able to change the src of image. Any one have a syntax example that they know works.
Thanks!
I want to change image src in lightning component from lightning controller.
<aura:component > <img aura:id="imgid" src="/files/image_name.jpg" ></img> <ui:inputCheckbox aura:id="checkbox" label="Select?" change="{!c.onCheck}"/> </aura:component>
({ onCheck: function (cmp, event, helper) { var checkCmp = cmp.find("imgid"); checkCmp.set("v.value", "/files/new_image_name.jpg"); } })
But with cmp.find("imgid") not able to change the src of image. Any one have a syntax example that they know works.
Thanks!
The cmp.find only finds the component, then you need to get the value.
It should work, because i think what's wrong with your code it's that you're trying to change something that you didn't find yet.
Yes i am fail to find how to get src value in lightning. If you have any solution please help us.