AngularJS – Format Text Return From JSON To Title Case

A filter is an ideal solution for this purpose

<div ng-repeat="name in FootballClubs">
    {{ name.CompanyName | titleCase }}
</div>

So the filter itself would be

angular.module('myFootballModule', [])
  .filter('titleCase', function() {
    return function(input) {
      input = input || '';
      return input.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
    };
  })

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)