I have the following markup in a Component
<aura:component controller="elfL1" implements="forceCommunity:availableForAllPageTypes,force:appHostable">
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<aura:attribute name="ts" type="String" />
<ltng:require
styles ="{!'/resource/' + v.ts + '/elfLightningFixes_css'}"
/>
{!'/resource/' + v.ts + '/elfLightningFixes_css'}
And in the controller I'm populating ts
init : function(component, event, helper) {
console.log('elfL1.init()');
component.set("v.ts",''+Math.round((new Date()).getTime())+'');
},
Now the simple expression output {!'/resource/' + v.ts + '/elfLightningFixes_css'}
works as expected as you see in the screenshot, but for <ltng:require/>
it seems handled as array of the single letters of the string
Any idea on how to use the expression in <ltng:require/>
?
UPDATE:
Even using only a string attribute, it fails
<aura:attribute name="requireStyles" type="String" />
<ltng:require
styles = "{!v.requireStyles}"
/>
setting the string in the clientside controller
var ts = '' + Math.round((new Date()).getTime());
component.set("v.requireStyles", '/resource/' + ts + '/elfLightningFixes_css' );
Error is very strange
Error during init : styles is undefined