dockerrrr
dockerrrr

Reputation: 297

Getting error globalize is undefined Typescript

I'm working on a angular 4 application which support L10n. Im using globalize. reference.Appcomponent.ts is as follows

import { Component,OnInit } from '@angular/core';
import globalize from "globalize";
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
ngOnInit()
{
  console.log(Globalize);
  Globalize.locale( "pt" );
 var formatter = Globalize.currencyFormatter( "USD" );
 console.log(formatter( 9.99 ));
}
}

During compile there is no errors,but runtime im getting error Globalize is not defined . Im stuck at this point .Any help is appreciated.

Upvotes: 1

Views: 452

Answers (1)

tamtoum1987
tamtoum1987

Reputation: 2057

Can you try to import it like this

import * as Globalize from 'globalize';

Upvotes: 0

Related Questions