In my lightning component I loop over records and display links to them:
1) Works, but is discouraged as it doesn't work in all places
<aura:iteration items="{!v.records}" var="record">
<a href="{!'/' + stage.id}" />
</aura:iteration
2) Tried that but fails with:
Cannot mix expression and literal string in attribute value
<aura:iteration items="{!v.records}" var="record">
<a onlick="navigateToSObjectonlick="sforce.one.navigateToSObject({!'/' + stage.id})" />
</aura:iteration
3) How to pass the recordId into myOwnNavigateToSObject()?
<aura:iteration items="{!v.records}" var="record">
<a onlick="{!c.myOwnNavigateToSObject}" />
</aura:iteration
My preferred solution is to make 2) work as I see no use of an additional controller function that just delegates work to navigateToSObject()
.