1

Previously I was able to have the following component and init function, where the Id for lightning:tab would be implicitly coerced to String from Number.

Component:

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
<aura:attribute name="List" type="List"/>
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

<lightning:tabset>
    <aura:iteration items="{!v.List}" var="a">
        <lightning:tab label="{!a.Name}" id="{!a.Number}">
            {!a.Name}
        </lightning:tab>

    </aura:iteration>

</lightning:tabset>

Init:

    doInit : function(component, event, helper) {
    var List = [];
    for (var i=0; i<4; i++) {
        var a = {
            Name: "a " + (i+1),
            Number: i
        }
        List.push(a);
    }
    component.set("v.List", List);
}

However, now in Winter '19 I have to explicitly define Number as i.toString() to be able to use the tabs correctly.

Are there any more examples of this stricter javascript -> aura/lightning definitions or is it just for this component?

tested this in communities btw.

Thank you

  • I'd update this myself, but I'm past my edit limit for the moment: The last line in your javascript should be component.set("v.weekList", List); – Shane Steinfeld Sep 29 '18 at 2:54
  • What's the error message (if any)? Very curious about this one. Does the compiler really care whether the value it's returning (some number in place of {!wk.Number}) makes sense in context of the markup. – Shane Steinfeld Sep 29 '18 at 3:05
  • @ShaneSteinfeld No error message, unless you debug it using Lightning Debug Chrome add-on. I suggest creating this yourself in a dev org to see the error in Winter '19. Then change "Number: i.toString()" to see it working as usual. – rna7 Oct 1 '18 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.