Access to just the Currency Symbol

876 views
Skip to first unread message

Randy Merrill

unread,
Mar 2, 2013, 11:48:17 AM3/2/13
to ang...@googlegroups.com
Been working on a simple Angular app and had a question about getting access to just the currency symbol for display, without a number with it.

I am using bootstrap for the UI and was trying to get it to show the currency symbol as a prepended add-on for the input, but I don't know how to get it to show the currency symbol that is currently the default:

<div class="input-prepend">
     <span class="add-on">{{currency}}</span>
     <input class="input-small" type="number" placeholder="Payment" title="Payment" ng-model="payment">
</div>

 Is there a way to access it without specifying a value to apply the filter to?

Thanks!

Pawel Kozlowski

unread,
Mar 2, 2013, 11:55:59 AM3/2/13
to ang...@googlegroups.com
Hi!

Not sure if I'm reading your question correctly but if you want to get
access to the currency symbol as outputed by the currency filter you
can do so by using the $locale service:

$locale.NUMBER_FORMATS.CURRENCY_SYM

at least this is how the filter does it:
https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js#L48

Please note that this is not considered as the "public" API:
http://docs.angularjs.org/api/ng.$locale

Cheers,
Pawel
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+u...@googlegroups.com.
> To post to this group, send email to ang...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Looking for bootstrap-based widget library for AngularJS?
http://angular-ui.github.com/bootstrap/
Reply all
Reply to author
Forward
0 new messages