An open API service indexing awesome lists of open source software.

https://github.com/doches/angular-decamel-filter

An AngularJS filter for converting 'camelCaseStrings' to 'Camel Case Strings'
https://github.com/doches/angular-decamel-filter

Last synced: 6 months ago
JSON representation

An AngularJS filter for converting 'camelCaseStrings' to 'Camel Case Strings'

Awesome Lists containing this project

README

          

# angular-decamel-filter

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](http://bower.io/):

```
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:

```html

...


...

var myApp = angular.module('myApp', ['te.decamel']);

...

```

## Usage

Use `decamel` like you would any other string filter:

```js
// scopeVariable is "fooBarBaz"

{{scopeVariable | decamel}}


```

...to produce human-friendly output:

```html

Foo Bar Baz


```

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

```js

{{scopeVariable | decamel:'_':true}}


```

...produces:

```html

foo_Bar_Baz


```