Skip to content

AoT build issue fix, Will be more collaborative repository. Since no activity of angular2-ui-switch repository.

License

Notifications You must be signed in to change notification settings

samuelsherrer/ngx-toggle-switch

 
 

Repository files navigation

Disclaimer

This switch is derived from webcat12345/ngx-ui-switch, which was itself derived from yuyang041060120/angular2-ui-switch, which is a dead repo. This is temporarily published so it can be properly npm installed but I will deprecate and redirect this package once the appropriate fixes & changes have been back PR'd into the common repo. Thanks guys for your amazingly hard work.

Ngx UI Switch Component

Greenkeeper badge Gitter Build Status npm version npm Throughput Graph

Description

This is a simple iOS 7 style switch component for Angular4.

alt

Inspired by switchery - in angular4.

Installation

npm install ngx-toggle-switch --save

Usage

import { UiSwitchModule } from 'ngx-toggle-switch/src'
import { AppComponent } from './app.component';

@NgModule({
    imports: [BrowserModule, FormsModule, UiSwitchModule],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule {
}
<ui-switch></ui-switch>

Two way binding

<ui-switch [(ngModel)]="enable"></ui-switch>

Params

checked

type: boolean

default: false

<ui-switch checked></ui-switch>
<ui-switch [checked]="false"></ui-switch>

disabled

type: boolean

default: false

<ui-switch disabled></ui-switch>
<ui-switch checked [disabled]="true"></ui-switch>

change

type: event

default: noop

<ui-switch (change)="onChange($event)"></ui-switch>

size

type: string

default: medium

<ui-switch size="small"></ui-switch>
<ui-switch size="large"></ui-switch>

reverse

type: boolean

default: false

<ui-switch reverse></ui-switch>

color

type: string

default: rgb(100, 189, 99)

<ui-switch color="red"></ui-switch>

switchColor

type: string

default: #fff

<ui-switch switchColor="#fcfcfc"></ui-switch>

defaultBgColor

type: string

default: #fff

<ui-switch defaultBgColor="red"></ui-switch>

defaultBoColor

type: string

default: #dfdfdf

<ui-switch defaultBgColor="black"></ui-switch>

Toggle text

<ui-switch labelOn="Yes" labelOff="No"></ui-switch>

License

MIT

About

AoT build issue fix, Will be more collaborative repository. Since no activity of angular2-ui-switch repository.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 73.2%
  • HTML 14.1%
  • JavaScript 12.7%