Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/ng-units
Collection of angular filters for converting numeric measurements (like cm -> inch)
https://github.com/binocarlos/ng-units
Last synced: 10 days ago
JSON representation
Collection of angular filters for converting numeric measurements (like cm -> inch)
- Host: GitHub
- URL: https://github.com/binocarlos/ng-units
- Owner: binocarlos
- License: mit
- Created: 2014-02-13T18:19:12.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-14T22:46:30.000Z (almost 11 years ago)
- Last Synced: 2024-04-14T14:36:44.632Z (7 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ng-units
========Collection of angular filters for converting numeric measurements (like cm -> inch)
## installation
```
$ component install binocarlos/ng-units
```## usage
```js
angular.module('myApp', [
require('ng-units')
]).controller('MyAppCtrl', function($scope, $safeApply){
$scope.cms = 12;
})
``````html
{{ measurement }} CM
{{ measurement | cm2inch | number:2 }} INCH
```You can use the angular 'number' filter to round the results (the above is 2 decimal places).
## cm2inch(cm)
return cm / 2.54
## inch2cm(inch)
return inch * 2.54
## contributing
There are lots of other units to add - pull requests welcome : )
## license
MIT