Manually firing an event
In contrast, other component and application events are fired manually by event.fire() in client-side controllers.
For example, in the component, define a handler with name="change"
<ui:inputDate aura:id="dateField" label="Birthday" value="2014-01-30" displayDatePicker="true"/>
A component can have multiple <aura:handler name="change"> tags to detect changes to different attributes.
In the controller, define the action for the handler.
({
itemsChange: function(cmp, evt) {
var v = evt.getParam("value");
if (v === cmp.get("v.items")) {
//do something
}
}
})
No comments:
Post a Comment