ngs-currency-converter
v1.0.0
Published
A simple currency converter for Angular
Downloads
7
Readme
Currency Converter
A simple and efficient currency converter library for Angular.
See the demo .
Features
✅ Observable support ✅ Async pipe support
Get Started
Step 1: install ngs-currency-converter
npm i ngs-currency-converter
Step 2: Import CurrencyConverterModule
into your app module, eg.:
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { CurrencyConverterModule } from 'ngs-currency-converter';
@NgModule({
declarations: [AppComponent],
imports: [
HttpClientModule,
CurrencyConverterModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule { }
Step 3: usage, eg.:
import { NgsCurrencyConverterService } from 'ngs-currency-converter';
@Component({
selector: 'app-root',
template: ` `,
})
export class AppComponent {
baseCurrency: string = 'USD';
toCurrency: string = 'INR';
quintet: number = 1;
constructor(private currencyService: NgsCurrencyConverterService) { }
ngOnInit(): void {
this.currencyService.getCounterName().subscribe((data) => {
console.log('Counter Name:', data);
});
this.getCurrencyRates(this.baseCurrency, this.toCurrency, this.quintet);
}
getCurrencyRates(fromCurrency: string, toCurrency: string, quintet: number): void {
this.currencyService.getLatestRates(fromCurrency, toCurrency, quintet).subscribe(
(convertedRate) => {
console.log('Converted Amount:',convertedRate);
},
(error) => {
console.error('Error fetching currency data', error);
}
);
}
}
Thanks for the Installation 😊🙏🏽
Thanks for using ngs-currency-converter