You need to sign in to do that
Don't have an account?
Brock Norton
Challenge not yet complete... here's what's wrong: The 'PhoneNumberEvent' event does not have an attribute component
I keep getting this error. Thoughts?
<aura:application attribute="phone"> <c:PhoneNumberInput /> <c:PhoneNumberOutput /> </aura:application>
The 'PhoneNumberEvent' event is not of type 'APPLICATION'.
Help?
Hi Brock Norton,
1-PhoneNumberEvent.evt
<aura:event type="APPLICATION" description="Event template">
<aura:attribute name="phone" type="String"/>
</aura:event>
2-PhoneNumberInput.cmp
<aura:component >
<ui:inputPhone aura:id="phone" label="phone" />
<aura:registerEvent name="phone" type="c:PhoneNumberEvent"/>
<ui:button label="Show Phone" />
</aura:component>
3-PhoneNumberOutput.Cmp
<aura:component >
<aura:attribute name="number" type="String" default="No Phone Number"/>
<ui:outputText aura:id="phone" value="{!v.number}"/>
<aura:handler event="c:PhoneNumberEvent" action="{!c.answer}"/>
</aura:component>
4-PhoneNumberOutputHelper.js
({
phonenum : function(component, event, helper) {
var phone = event.getParam("phone");
component.set("v.number", phone);
}
})
5-PhoneNumberInputHelper.js
({
send : function(component, event, helper) {
var phone = component.find("phone").get("v.value");
console.log(phone);
$A.get("e.c:PhoneNumberEvent").setParams({
phone: phone
}).fire();
}
})
In this way you can complete your chalange ..