0.0.6 • Published 12 months ago

@nikiphoros/ngx-toggle v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
12 months ago

Getting Started

This directive library helps you to set the value of ngTrue and ngFalse for HTML Form checkbox element in angular other than boolean value(true|false). It is simply an alternative to the ng-true-value and ng-false-value in angular 2+.

Authors

Installation

Install @nikiphoros/ngx-toggle with npm

  npm install @nikiphoros/ngx-toggle

Add needed package to NgModule imports:

import { NgxToggleModule } from '@nikiphoros/ngx-toggle';

@NgModule({
  ...
  imports: [NgxToggleModule,...]
  ...
})

Uses

existing behavior which only return only boolean (true|false)

<input id="status" type="checkbox" name="status" [(ngModel)]="status">
<label for="status">result {{status}}</label>

add ToggleValue directive and custom value for true & false which you want to set as below,

<input id="switch" type="checkbox" name="switch" [(ngModel)]="switch" ToggleValue [true]="'on'" [false]="'off'">
<label for="status">  result {{switch}}</label>
0.0.6

12 months ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago