Last active
October 18, 2023 19:34
-
-
Save paulakreuger/b2af1958f3d67f46447e to your computer and use it in GitHub Desktop.
Capitalize First Letter Filter - AngularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('capitalize', function() { | |
return function(input, scope) { | |
if (input!=null) | |
input = input.toLowerCase(); | |
return input.substring(0,1).toUpperCase()+input.substring(1); | |
} | |
}); |
Can you explain me how it works?
The idea is to convert the string to lower case, then let CSS capitalize each first letter. It can be necessary if you need to prevent the edge cases mentioned by @martininf.
Okay i got thanks.
…On Sun, Jul 26, 2020, 6:50 PM Simone Vittori ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Can you explain me how it works?
The idea is to convert the string to lower case, then let CSS capitalize
each first letter. It can be necessary if you need to prevent the edge
cases mentioned by @martininf <https://github.com/martininf>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/b2af1958f3d67f46447e#gistcomment-3391890>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJ7RFDKZLGH7ZKKIRLUBIIDR5QUSVANCNFSM4HHCPIXA>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you explain me how it works?