The ‘PhoneNumberOutput’ component is not using a handler component

The ‘PhoneNumberOutput’ component is not using a handler component

Use the below code

Component Code:

<aura:component>
    <aura:registerEvent name=”message” type=”c:PhoneNumberEvent”/>
    <aura:handler event=”c:PhoneNumberEvent” action=”{!c.answer}”/>
    <aura:attribute name=”number” type=”String” default=”No Phone Number”/>
    <ui:outputText aura:id=”phone” value=”{!v.number}”/>
</aura:component>


Controller Code:

({
answer : function(component, event, helper) {
var text = event.getParam(“phone”);
        component.set(“v.number”, text);
}
})

Cheers!!!

Leave a Reply