How can I capitalize the first letter of a string using Angular or typescript?
function titleCaseWord(word: string) {
if (!word) return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
You can also use in template TitleCasePipe
Some component template:
{{value |titlecase}}