I need help with spfx that uses handelbear, please!

Iron Contributor

Hi,

I found a web part called React Content Query. It is Avery nice app, you can find it here: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-content-query-webpart

 

Well, I am having problem trying to show the banner image of a page. 

One of the properties that the web part is giving me is the banner image url (bannerImageUrl), the problem is that the value is: 

 

https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=18413909-0b3e-4f55-ba0c-35ecb60721d4&guidWeb=0a95d1fa-6f11-432c-9231-aa46da033705&guidFile=3fdf3e2e-bf6b-427c-9a47-1316005908a5, https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=18413909-0b3e-4f55-ba0c-35ecb60721d4&guidWeb=0a95d1fa-6f11-432c-9231-aa46da033705&guidFile=3fdf3e2e-bf6b-427c-9a47-1316005908a5

As you can see it is a string with two URL:s separate by a comma.

In JavaScript I could do like this to get the second url, which is the link to the image:

var string = "https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=18413909-0b3e-4f55-ba0c-35ecb60721d4&guidWeb=0a95d1fa-6f11-432c-9231-aa46da033705&guidFile=3fdf3e2e-bf6b-427c-9a47-1316005908a5, https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=18413909-0b3e-4f55-ba0c-35ecb60721d4&guidWeb=0a95d1fa-6f11-432c-9231-aa46da033705&guidFile=3fdf3e2e-bf6b-427c-9a47-1316005908a5";

string = string.split(',')[1];

 But the problem is that the webpart is using handelbear and the code that get the url:s looks like this:

 

<span><b>BannerImageUrl : </b>{{BannerImageUrl.textValue}}</span>

 I have tried: 

{{BannerImageUrl.textValue}}.split(',')[1]

 But is not working. How can I split the string that is in the textValue? 

 

Best regards

Americo

1 Reply

@Americo Perez I had the same problem. The short answer is {{before (split BannerImageUrl.textValue ",") 1}}.

 

I found this by reviewing the handlebar helper documentation and then searching for nesting handlebar helpers.  

 

Hope it works for you.