Code Monkey home page Code Monkey logo

ng-flag-pipe's Introduction

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-pipe OR yarn add flag-pipe OR pnpm add flag-pipe
  • Import FlagPipeModule in your AppModule or SharedModule:

import { FlagPipeModule } from "flag-pipe";
  • Import FlagPipeModule in ngModule:

@NgModule({
  imports: [
		flagPipeModule.forRoot({
			config: {
				flagExtensions: "png",
				flagType: "FIXED_HEIGHT",
				flagSize: "h20",
			},
		}),
  ]
})

Usage :

  • Use flag pipe in your template (Required):

  • Use CountryCode as [ ISO 3166-1 alpha-2 ] format

    -> CountryCode type already implemented in flag-pipe library you can use it as CountryCode type. REF : ISO 3166-1 alpha-2 + Country Codes in Json

  • Use flagExtension as [ "png" | "svg" | "webp" ]

    -> flagExtension type already implemented in flag-pipe library you can use it as flagExtension type.

  • Use flagTypies [ 'WAVY' | 'FIXED_HEIGHT' | 'FIXED_WIDTH' ]

    -> flagTypies type already implemented in flag-pipe library you can use it as flagTypies type.

  • Use flagSize [ "w160" | "h240" | "256x192" ]

    -> FlagSize type already implemented in flag-pipe library you can use it as FlagSize type.

    flag Type FIXED_HEIGHT FIXED_WIDTH WAVY
    flag Size Format h20 w20 36x27
    Img Fixed height Fixed Width Wavy image


Full Example :
<img [src]="'qa' | flag : 'svg' : flagType : '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.

ng-flag-pipe's People

Contributors

mahmoudibrahim03 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

bishoybeb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.