@nikiphoros/ngx-toggle
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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>

Readme

Keywords

none

Package Sidebar

Install

npm i @nikiphoros/ngx-toggle

Weekly Downloads

106

Version

0.0.6

License

none

Unpacked Size

30.9 kB

Total Files

18

Last publish

Collaborators

  • nikiphoros