Persian pipes for Angular2 apps.
npm install angular2-persian-pipes --save
Import PersianPipesModule
into your app's modules:
import {PersianPipesModule} from 'angular2-persian-pipes'
@NgModule({
imports: [
PersianPipesModule
]
})
This makes all the angular2-persian-pipes
pipes available for use in your app.
This pipe take a Template expressions
and check it is persian number?
<h3>{{1234567890 | isPerNumber}}</h3> <!--output: false-->
<h3>{{'1234567890' | isPerNumber}}</h3> <!--output: false-->
<h3>{{'1۱2۲3۳4۴5۵6۶7۷8۸9۹0۰' | isPerNumber}}</h3> <!--output: false-->
<!-- ۱۲۳٤٥٦۷۸۹۰ is arabic number. -->
<h3>{{'۱۲۳٤٥٦۷۸۹۰' | isPerNumber}}</h3> <!--output: false-->
<h3>{{'۱۲۳۴۵۶۷۸۹۰' | isPerNumber}}</h3> <!--output: true-->
This pipe take a Template expressions
and convert to persian digits.
<h3>{{'12345679' | perNumber}}</h3> <!--output: ۱۲۳۴۵۶۷۹-->
This pipe take a Template expressions
and convert to english number.
<h3>{{'1234567890' | perToEngNumber}}</h3> <!--output: 1234567890-->
<h3>{{'۱۲۳۴۵۶۷۸۹۰' | perToEngNumber}}</h3> <!--output: 1234567890-->
<!-- this pipe just persian number to english number and arabic number not suported this pipe. -->
<h3>{{'۱۲۳٤٥٦۷۸۹۰' | perToEngNumber}}</h3> <!--output: 0-->