I want to create a reusable function that could be used in angular templates. I have created a function as:
export function stringSplit(string : string, separator : string = '/') : any {
return string.split(separator);
}
I have tried to add into the template like this:
<p> stringSplit('hello/user') </p>
But i am getting this error:
ERROR TypeError: _co.stringSplit is not a function
I am not sure how we can create and use global functions in angular.
Can we perform this operation in angular?
What is the best solution in this situation?