pipe currency
This commit is contained in:
parent
f6850072ea
commit
56f6063648
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 38c26d9649f613e4f8987e4e4727a0e90a21233b
|
Subproject commit 5571fbe8bfc50d1ab56118607a9ad0d8d10d59d5
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { CurrencyPipe } from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { ToasterService } from 'angular2-toaster';
|
import { ToasterService } from 'angular2-toaster';
|
||||||
|
@ -19,13 +20,15 @@ export class PremiumComponent extends BasePremiumComponent {
|
||||||
|
|
||||||
constructor(analytics: Angulartics2, toasterService: ToasterService,
|
constructor(analytics: Angulartics2, toasterService: ToasterService,
|
||||||
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
|
||||||
tokenService: TokenService, apiService: ApiService) {
|
tokenService: TokenService, apiService: ApiService,
|
||||||
|
private currencyPipe: CurrencyPipe) {
|
||||||
super(analytics, toasterService, i18nService, platformUtilsService, tokenService, apiService);
|
super(analytics, toasterService, i18nService, platformUtilsService, tokenService, apiService);
|
||||||
|
|
||||||
// Support old price string. Can be removed in future once all translations are properly updated.
|
// Support old price string. Can be removed in future once all translations are properly updated.
|
||||||
this.priceString = i18nService.t('premiumPrice', this.price);
|
const thePrice = this.currencyPipe.transform(this.price, '$');
|
||||||
|
this.priceString = i18nService.t('premiumPrice', thePrice);
|
||||||
if (this.priceString.indexOf('%price%') > -1) {
|
if (this.priceString.indexOf('%price%') > -1) {
|
||||||
this.priceString = this.priceString.replace('%price%', this.price);
|
this.priceString = this.priceString.replace('%price%', thePrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue