Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Globalize with Angular #916

Open
eluchsinger opened this issue Feb 16, 2021 · 1 comment
Open

Integrate Globalize with Angular #916

eluchsinger opened this issue Feb 16, 2021 · 1 comment

Comments

@eluchsinger
Copy link

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:

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);
  }

}
@eluchsinger eluchsinger changed the title Run Globalize on Angular Integrate Globalize with Angular Feb 16, 2021
@mellis481
Copy link

@eluchsinger Did you find a solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants