AngularJS – How to Capitalize the first letter of word Using filter?

AngularJS – How to Capitalize the first letter of word Using filter?

In this post we will give you information about AngularJS – How to Capitalize the first letter of word Using filter?. Hear we will give you detail about AngularJS – How to Capitalize the first letter of word Using filter?And how to use it also give you demo for it if it is necessary.

Sometimes, we want to make Capitalize string in our AngularJS project then we have to create filter because AngularJS not provide any predefined function that can Capitalize word or string.

However, you can solve this problem by makeing your own filter that can help you to make

Capitalize string or word. so let’s see following example and use it.

Create Filter:

var app = angular.module('myApp', []);

app.filter('capitalizeWord', function() {

return function(text) {

return (!!text) ? text.charAt(0).toUpperCase() + text.substr(1).toLowerCase() : '';

}

});

Use Filter:

<p>{{ yourWord | capitalizeWord }}</p>

Hope this code and post will helped you for implement AngularJS – How to Capitalize the first letter of word Using filter?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

79  +    =  89

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US