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'
- Host: GitHub
- URL: https://github.com/doches/angular-decamel-filter
- Owner: doches
- License: mit
- Created: 2016-02-06T03:40:49.000Z (over 10 years ago)
- Default Branch: develop
- Last Pushed: 2016-02-06T04:03:26.000Z (over 10 years ago)
- Last Synced: 2026-01-25T10:56:57.491Z (6 months ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```