Reputation: 596
I am going to achieve like this ${context:layout/images/${itemProperty.signImage}.png}. But I got the following error
Could not convert 'context:layout/images/${itemProperty.signImage' into a component parameter binding: Unable to locate asset 'context:layout/images/${itemProperty.signImage' (the file does not exist). [at classpath:net/web/app/sample/pages/Test.tml, line 30].
Please any one say how can I achieve.
Upvotes: 2
Views: 1446
Reputation: 3791
You can not use expressions inside context expression. But you can obtain asset through AssetSource service:
@Inject
private AssetSource assetSource;
public Asset getSignImage() {
final String path = "layout/images/" + itemProperty.getSignImage() + ".png";
return assetSource.getContextAsset(path, null);
}
Upvotes: 3