You need to sign in to do that
Don't have an account?

Problems solving "Using Events to Center the Map" trailhead
Hi,
This is the error that appears:
Step Not yet complete... here's what's wrong:
AccountListItem's JS controller doesn't get a reference to the AccountSelected event
Note: you may run into errors if you've skipped previous steps.
I´ve done every step as they told me to do. If you could help me see the erro I would really appreciate it guys.
Hereare the screen shots of the part of the code that's been giving me problems:
- AccountList component:
<aura:component controller="AccountController">
<aura:registerEvent name="accountsLoaded" type="c:AccountsLoaded"/>
<aura:registerEvent name="accountSelected" type="c:AccountSelected"/>
<aura:attribute name="accounts" type="Account[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<ul>
<aura:iteration items="{!v.accounts}" var="account">
<c:AccountListItem account="{!account}"/>
</aura:iteration>
</ul>
<li><a onclick="{!c.accountSelected}">{!v.account.Name}</a></li>
</aura:component>
- AccountList Controller:
({
accountSelected : function(component) {
var event = $A.get("e.c:AccountSelected");
event.setParams({"account": component.get("v.account")});
event.fire();
}
})
Thank you guys.
This is the error that appears:
Step Not yet complete... here's what's wrong:
AccountListItem's JS controller doesn't get a reference to the AccountSelected event
Note: you may run into errors if you've skipped previous steps.
I´ve done every step as they told me to do. If you could help me see the erro I would really appreciate it guys.
Hereare the screen shots of the part of the code that's been giving me problems:
- AccountList component:
<aura:component controller="AccountController">
<aura:registerEvent name="accountsLoaded" type="c:AccountsLoaded"/>
<aura:registerEvent name="accountSelected" type="c:AccountSelected"/>
<aura:attribute name="accounts" type="Account[]"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<ul>
<aura:iteration items="{!v.accounts}" var="account">
<c:AccountListItem account="{!account}"/>
</aura:iteration>
</ul>
<li><a onclick="{!c.accountSelected}">{!v.account.Name}</a></li>
</aura:component>
- AccountList Controller:
({
accountSelected : function(component) {
var event = $A.get("e.c:AccountSelected");
event.setParams({"account": component.get("v.account")});
event.fire();
}
})
Thank you guys.
<li><a onclick="{!c.accountSelected}">{!v.account.Name}</a></li>
in AccountList component.
I think it should go in AccountList Item component.
I got a bit further but got an error on selecting an account:
-------
Something has gone wrong. Action failed: c$AccountMap$controller$accountSelected [TypeError: Unable to get property 'reuseTiles' of undefined or null reference]
Failing descriptor: {c$AccountMap$controller$accountSelected}.
-------
Will have to look at it again.
AccountMap.cmp
AccountMapController.js
AccountList.cmp
AccountListController.js
AccountListItem.cmp
AccountListItemController.js
However, selecting an account from the list gives me a different error when testing the account selection functionality.
Error: Uncaught Assertion Failed!: Unkown conroller action 'AccountSelected' : undefined
I'll try reaching out to Trailhead support to see if they can identify why the code passes the verification, but does not work as expected.
The list of accounts is correct but it doesn't draw the markers.
I tried creating a new marker but that didn't work.
Trailhead support?
Same Trailhead Project Module, other topic: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000kHVhIAM