Custom capitalize filter
Description
The following code shows how to create a custom capitalize filter.
Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from w w w. jav a2 s. co m-->
<body ng-app="app">
<span>{{ "this is some text" | capitalize }}</span>
<script type='text/javascript'>
var app = angular.module('app', []);
app.filter('capitalize', function() {
return function(input, param) {
return input.substring(0,1).toUpperCase()+input.substring(1);
}
});
</script>
</body>
</html>