0.0.6 • Published 2 years ago

@nikiphoros/ngx-toggle v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
2 years 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

2 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago