srs-map-data
v0.0.1
Published
Simple pipe for match and transformation data.
Downloads
1
Maintainers
Readme
SRS-Map-Data
Simple pipe for match and transformation data.
Table of Contents
Installation
$ npm i srs-map-data
Usage
To use SrsMapDataPipe in your Angular project, import the SrsMapDataModule into your module and add it to your template.For example, to use the mapdata
pipe:
In your app.module:
import { SrsMapDataModule } from 'srs-map-data';
@NgModule({
// ...
imports: [
// ...
SrsMapDataModule,
// ...
],
// ...
})
export class AppModule { }
In your component's template:
<p>{{ data | mapdata : arg1 : arg2 : arg3 }}</p>
arg1
Your data list
arg2
Key value of input
arg3
Key value of output
Example
In your component's template:
<p>{{ "TH" | mapdata : list : "code" : "name" }}</p>
In your component's script:
list = [
{
code: 'TH',
name: 'Thailand',
},
{
code: 'JP',
name: 'Japan',
},
{
code: 'UK',
name: 'United Kingdom',
},
{
code: 'UK',
name: 'United Kingdom',
},
];
// Pipe Output : Thailand