Hi Team,
I have to display the current page title on the basis of checkbox value and in else condition i need to display deafult vale.
I tried but it is not working it is act as string
title:${properties.pagetitle ?'currentPage.title':' properties.headline'}
it display me currentPage.title
is there anything wrong in the syntax.
Views
Replies
Total Likes
Hi @savi50 ,
Yes there is syntax error (Do not use inverted commas inside {}), please use as :
${properties.pageTitle? currentPage.title : properties.headline}
Thanks
Hi @milind_bachani ,
I already tried above but it is giving error
Please separate ternary operators with a white-space to provide clarity to the parser. In your case this would be where the colon `:` is used:
${properties.pageTitle ? currentPage.title : properties.headline}
You may also want to confirm your letter-casing and scope (component vs page).
Please use proper spacing before and after the operators ( ? : )and then try.
I also reverified the same on my local it works fine when I use something like :
${properties.prop1 ? properties.prop1 : currentPage.pageTitle}
OR
${properties.prop1?properties.prop1 : currentPage.pageTitle}
But, gives a blank page when I do
${properties.prop1 ? properties.prop1:currentPage.pageTitle}
Hence, please check the whitespaces.