new UnitPrefix($filter)
A filter used to format a number with the prefix and unit
Arguments:
- opt_unit: The unit to used, default is ''.
- opt_type: (unit|square|binary) the type of units, default is 'unit'.
- opt_precision: The used precision, default is 3.
Examples:
{{25000 | ngeoUnitPrefix}} => 25 k
{{25000 | ngeoUnitPrefix:m}} => 25 km
{{25000000 | ngeoUnitPrefix:m²:square}} => 25 km²
{{2048 | ngeoUnitPrefix:o:binary}} => 2 Kio
Parameters:
Name | Type | Description |
---|---|---|
$filter |
angular.$filter | Angular filter |
Returns:
ngeox.unitPrefix
Function used to format number into a string.
Methods
(inner) result(number, [opt_unit]opt, [opt_type]opt, [opt_precision]opt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
number |
number | The number to format. |
|
[opt_unit] |
string= |
<optional> |
The unit to used, default is ''. |
[opt_type] |
string= |
<optional> |
(unit|square|binary) the type of units, default is 'unit'. |
[opt_precision] |
number= |
<optional> |
The used precision, default is 3. |
Returns:
string
The formatted string.