I'm trying to get Globalize running on Angular and it seems to me that it's not so easy. I haven't found any full examples on how to do that and only some incomplete samples.
Basically, I have the following component, but I always get the following error currencyFormatter is not a function:
import { Component } from "@angular/core";
import { AuthenticationService } from "../services/AuthenticationService";
import { Router } from "@angular/router";
import likelySubtags from "cldr-data/supplemental/likelySubtags.json";
import * as cldr from "cldrjs";
import * as Globalize from "globalize";
@Component({
selector: "app-index",
templateUrl: "./index.component.html",
styleUrls: ["./index.component.css"],
})
export class IndexComponent {
currency = 123;
formattedCurrency = "";
constructor(
private router: Router,
private authService: AuthenticationService
) {
Globalize.load(likelySubtags);
const formatter = new Globalize("de").currencyFormatter("USD");
this.formattedCurrency = formatter(Math.PI);
}
}
Hi folks
I'm trying to get Globalize running on Angular and it seems to me that it's not so easy. I haven't found any full examples on how to do that and only some incomplete samples.
Basically, I have the following component, but I always get the following error
currencyFormatter is not a function
: