CodeBee logo


Author: Trevor Fountain

An AngularJS filter (with no external dependencies) for converting camelCaseStrings to "Camel Case Strings". Useful for quickly converting programmer-friendly keys to user-facing labels; I use it for creating on-the-fly table headers.

Getting Started

(1) Install using Bower:

bower install angular-decamel-filter

(2) Include angular-decamel-filter.js in your index.html, somewhere after Angular itself.

(3) Add te.decamel to your main module's list of dependencies.

When you're done, your setup should look something like:

<!doctype html>
<html ng-app="myApp">

    <script src=""></script>
    <script src="bower_components/angular-decamel-filter/src/angular-decamel-filter.js"></script>
        var myApp = angular.module('myApp', ['te.decamel']);


Use decamel like you would any other string filter:

// scopeVariable is "fooBarBaz"
<h1>{{scopeVariable | decamel}}</h1> produce human-friendly output:

<h1>Foo Bar Baz</h1>

Want finer-grained control over your dedromedization? You can specify a custom delimiter, or disable initial capitalization:

<h1>{{scopeVariable | decamel:'_':true}}</h1>