https://nbfontana.github.io/ngx-currency/
Install the package by command:
npm install ngx-currency --save
Import the module
import { NgxCurrencyModule } from "ngx-currency";
@NgModule({
imports: [
...
NgxCurrencyModule
],
declarations: [...],
providers: [...]
})
export class AppModule {}
<input currencyMask formControlName="value" />
ngModel
An attribute of type number. If is displayed '$ 25.63'
, the attribute will be '25.63'
.You can set options...
<!-- example for pt-BR money -->
<input currencyMask formControlName="value" [options]="{ prefix: 'R$ ', thousands: '.', decimal: ',' }"/>
Available options:
align
- Text alignment in input. (default: right
)allowNegative
- If true
can input negative values. (default: true
)decimal
- Separator of decimals (default: '.'
)precision
- Number of decimal places (default: 2
)prefix
- Money prefix (default: '$ '
)suffix
- Money suffix (default: ''
)thousands
- Separator of thousands (default: ','
)nullable
- when true, the value of the clean field will be null
, when false the value will be 0
min
- The minimum value (default: undefined
)max
- The maximum value (default: undefined
)inputMode
- Determines how to handle numbers as the user types them (default: FINANCIAL
)Input Modes:
FINANCIAL
- Numbers start at the highest precision decimal. Typing a number shifts numbers left.The decimal character is ignored. Most cash registers work this way. For example:
'12'
results in '0.12'
'1234'
results in '12.34'
'1.234'
results in '12.34'
NATURAL
- Numbers start to the left of the decimal. Typing a number to the left of the decimal shiftsnumbers left; typing to the right of the decimal replaces the next number. Most text inputsand spreadsheets work this way. For example:
'1234'
results in '1234'
'1.234'
results in '1.23'
'12.34'
results in '12.34'
'123.4'
results in '123.40'
You can also set options globally...
import { CurrencyMaskInputMode, NgxCurrencyModule } from "ngx-currency";
export const customCurrencyMaskConfig = {
align: "right",
allowNegative: true,
allowZero: true,
decimal: ",",
precision: 2,
prefix: "R$ ",
suffix: "",
thousands: ".",
nullable: true,
min: null,
max: null,
inputMode: CurrencyMaskInputMode.FINANCIAL
};
@NgModule({
imports: [
...
NgxCurrencyModule.forRoot(customCurrencyMaskConfig)
],
declarations: [...],
providers: [...],
bootstrap: [AppComponent]
})
export class AppModule {}
Input not working on mobile keyboard
<!-- Change the type to 'tel' -->
<input currencyMask type="tel" formControlName="value" />
Input focus get hide by the mobile keyboard
on HTML
<!-- Change the type to 'tel' -->
<input currencyMask type="tel" formControlName="value" [id]="'yourInputId' + index" (focus)="scrollTo(index)" />
on .ts
import { Content } from 'ionic-angular';
export class...
@ViewChild(Content) content: Content;
scrollTo(index) {
let yOffset = document.getElementById('yourInputId' + index).offsetTop;
this.content.scrollTo(0, yOffset + 20);
}
npm install
while current directory is this repoRun npm start
or npm run demo
to start a development server on port 8000 with auto reload + tests.
npm test
to run tests oncenpm run test:watch
to continually run tests in headless modenpm run test:watch-browser
to continually run tests in the Chrome browserWhen running in the Chrome browser, you can set code breakpoints to debug tests using these instructions:
Debug
button to open the debug windowctrl + shift + i
to open Chrome developer toolsctrl + p
to search for a file to debuginput.handler.ts
and click the fileMIT @ Neri Bez Fontana
ngx-weui 是一个使用 Angular 构建的 WeUI 组件。 在线示例以及API文档。
ngx-fastdfs 是 nginx + lua +fastdfs 实现分布式图片实时动态压缩。 install 进入docker目录docker build -t fastdfs:dev . 使用 docker -idt -p 80:80 fastdfs:dev /bin/bash进入容器执行/etc/rc.local 测试 进入容器执行test目录下的./test.sh或者直接执行下面脚本
ngx-markdown ngx-markdown is an Angular library that combines... Marked to parse markdown to HTML Prism.js for language syntax highlight Emoji-Toolkit for emoji support KaTeX for math expression rende
ngx-admin Who uses ngx-admin?| Documentation | Installation Guidelines | Angular templates New! Material theme for ngx-admin Material admin theme is based on the most popular Angular dashboard templat
@sweetalert2/ngx-sweetalert2 Official SweetAlert2 integration for Angular This is not a regular API wrapper for SweetAlert (which already works very well alone), it intends to provide Angular-esque ut
ngx-dropzone A lightweight and highly customizable Angular dropzone component for file uploads. For a demo see DEMO. And the CODE for the demo. Install $ npm install --save ngx-dropzone Usage // in ap
ngx-slick Support angular 6+, Slick 1.8.1 Example Installation To install this library, run: $ npm install ngx-slick --save Consuming your library Once you have published your library to npm, you can
Angular Module for displaying a feed of items in a masonry layout using https://github.com/desandro/masonry This package was originally a fork from https://github.com/jelgblad/angular2-masonry to allo