In reference to this link https://docs.nativescript.org/core-concepts/data-binding#supported-expressions
function calls myFunc(var1, var2, ..., varN) Where myFunc is a function available in binding context (used as context for expression) or within application level resources. The value of the var1 and varN will be used as parameter(s).
Im using a RadList where for each item i have a Label where i need to show a composed string checking complex logics based on item params.
Can anyone give typescript example how we can use function calls. I tried many ways but nothing worked.
As Culita suggested - using $parent should work, but it doesn't. This seems like a bug to me, make sure to open a new issue about it in the respective GitHub repository.
As a workaround, you can create the function in the type you are using to bind the template to. In this case - it works as expected:
class Location {
constructor(city: string, country: string, imageSrc: string) {
this.city = city;
this.country = country;
this.imageSrc = imageSrc;
}
city: string;
country: string;
imageSrc: string;
getLabel(args): string {
return "a" !== args ? "My label" + args : "Your Label ? " + args;
}
}
Take a look at the modified Playground.