4

I've have this handler

<aura:handler name="change" value="{!v.foo}" action="{!c.baz}"/>

Is there a way to know whether the value was modified from button click (via component.set(), etc) versus modified from input field?

3

I don't believe there is directly.

I assume you want to perform different actions based on what caused it?

If so, it would be best to either directly call the method you want to occur, in a helper method or using the <aura:method> registration, when you use component.set() in your code.

If you do that then the button click will have its own logic keeping everything separate.

  • 1
    I think that's right. When you put an aura:handler on a component, the event argument that gets passed to the client-side controller function for that handler's action always seems to have that component's aura:id as the event.getSource().getLocalId() no matter how the attribute value is updated. – martin Mar 20 '17 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.