• Narender Kumar
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hello Everyone,

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!
Hello Everyone,

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!