ng-capitalize-filter

Angular filter that capitalizes each word in a string, read about it on https://ngmilk.rocks/2015/04/03/angularjs-filter-that-capitalizes-each-word-in-a-string/.

Usage no npm install needed!

<script type="module">
  import ngCapitalizeFilter from 'https://cdn.skypack.dev/ng-capitalize-filter';
</script>

README

Angular capitalize filter

Quick Demo

Angular filter that capitalizes each word in a string, read about it on here. CSS is fairly powerful, but it can only capitalize words that aren't uppercase. The text-transform:capitalize property won't change anything in a string like CAN'T GET ME CSS. Use this directive to achieve consistent capitalization of each word in a given string.

Usage

  1. Include ng-capitalize.js.
  2. Add dm.capitalize as a dependency to your app.
  3. Profit!

Bower

Installable via bower:

bower install ng-capitalize

Npm

Installable via npm:

npm install ng-capitalize-filter --save

Example

See index.html for an example.

  <script>
    angular.module('app', ['dm.capitalize']);
  </script>

  <ul ng-app="app">
    <li>{{'MOUNTAIN' | capitalize}}</li> <!-- Mountain -->
    <li>{{'MOUNTAIN DOOM' | capitalize}}</li> <!-- Mountain Doom -->
  </ul>

About ngmilk

ngmilk is the place to go for fresh front-end articles, with a focus on AngularJS. See more on ngmilk.rocks

Follow @ngmilkrocks on Twitter to stay ahead of the game.