1.5.0 • Published 2 years ago
flag-pipe
Licence
MIT
Version
1.5.0
Deps
1
Size
53 kB
Vulns
0
Weekly
0
ng-Flag Pipe
[ Component In-progress ]
Flag Pipe : is an Angular library
that provides a pipe to [src] attribute on <img> to dynamically import flag image path.
Getting Started
Dependencies
- Angular 11.2.0 -> latest version
Installing
npm install flag-pipeORyarn add flag-pipeORpnpm add flag-pipeImport
FlagPipeModulein yourAppModuleorSharedModule:
import { FlagPipeModule } from "flag-pipe";
@NgModule({
imports: [
flagPipeModule.forRoot({
config: {
flagExtensions: "png",
flagType: "FIXED_HEIGHT",
flagSize: "h20",
},
}),
]
})
Usage :
Use
flagpipe in your template:Use CountryCode as
[ ISO 3166-1 alpha-2 ]format->
CountryCodetype already implemented inflag-pipelibrary you can use it asCountryCodetype. REF : ISO 3166-1 alpha-2 + Country Codes in JsonUse
flagExtensionas [ "png" | "svg" | "webp" ]->
flagExtensiontype already implemented inflag-pipelibrary you can use it asflagExtensiontype.Use
flagTypies[ 'WAVY' | 'FIXED_HEIGHT' | 'FIXED_WIDTH' ]->
flagTypiestype already implemented inflag-pipelibrary you can use it asflagTypiestype.Use
flagSize[ "w160" | "h240" | "256x192" ]->
FlagSizetype already implemented inflag-pipelibrary you can use it asFlagSizetype.flag Type FIXED_HEIGHT FIXED_WIDTH WAVY flag Size Format h20w2036x27Img 


Full Example :
<img [src]="'qa' | flag : 'svg' : WAVY : 'w160'" />
Future Plans
- [ In-Progress ] Create a component to use it as
<flag>tag. - Add more features to the component.
- CI/CD with Github Actions.
Acknowledgments
Inspirations.
Contributions
This project is an easy and simple project to contribute to. Feel free to open issues and pull requests.