Skip to content

Instantly share code, notes, and snippets.

@Theasker
Created June 18, 2018 07:27
Show Gist options
  • Select an option

  • Save Theasker/97b81f122fa24dae94ec865a44236a75 to your computer and use it in GitHub Desktop.

Select an option

Save Theasker/97b81f122fa24dae94ec865a44236a75 to your computer and use it in GitHub Desktop.
Angular number pipe with locale Internationalization (i18n)
import { Component, OnInit, LOCALE_ID } from '@angular/core';
//import { merge } from 'rxjs';
//import { MyCurrencyFormatterDirective } from "./directivas/my-currency-formatter.directive";
// Locales para number pipe
import { registerLocaleData } from '@angular/common';
import es from '@angular/common/locales/es';
registerLocaleData(es, 'es');
@Component({
selector: 'app-root',
template: `Number pipe: {{ num | number }}`,
styleUrls: ['./app.component.css'],
providers: [
{ provide: LOCALE_ID, useValue: 'es' },
]
})
export class AppComponent implements OnInit {
public num: number = 123456.78;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment