angular-capitalize-filter

AngularJS filter to capitalize sentences and specially team names.

Angular Core Dependency: ^1.2.15

Module License: MIT

Added by: Sam Deering

GitHub

Repository

puigcerber/angular-capitalize-filter

Stats

Stars: 14

Watchers: 14

Forks: 3

Module Description

angular-capitalize-filter

AngularJS filter to capitalize sentences and specially team names.

Installation

You can install the filter using Bower:

$ bower install angular-capitalize-filter

Or npm:

$ npm install angular-capitalize-filter

Then you have to include it in your HTML:

<script src="bower_components/angular-capitalize-filter/capitalize.js"></script>
<script src="node_modules/angular-capitalize-filter/capitalize.js"></script>

And inject the module angular-capitalize-filter as a dependency in your application:

angular.module('webApp', ['angular-capitalize-filter']);

Usage

You can use it like any other AngularJS filter:

<p>{{ input | capitalize:format }}</p>

Available formats:

All

It capitalizes all the words of a given sentence. As it's the default format you can omit the parameter.

<p>{{ sentence | capitalize:'all' }}</p>

First

It capitalizes just the first letter of the given sentence.

<p>{{ sentence | capitalize:'first' }}</p>

Team

Specially adapted for team names, with uppercase abbreviation.

<p>{{ teamName | capitalize:'team' }}</p>

It formats the team name as CD Logroñés, FC Barcelona or Valencia CF.

Testing

To run the tests:

$ npm install && bower install
$ grunt test

Module stats last updated: 2017-05-12 16:00:06

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!