1.0.5 • Published 4 years ago

ng-custom-checkbox-values v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

angular-custom-checkbox-values

Custom checkbox values like strings or numbers other than default boolean

Install

$ npm i ng-custom-checkbox-values

Usage

Presently works with angular reactive form components only.

Add CustomCheckboxValuesDirective to NgModule

import { CustomCheckboxValuesDirective } from "ng-custom-checkbox-values";

@NgModule({
	declarations: [
		CustomCheckboxValuesDirective,
		...
	]
	...
}

Provide checkedValue, uncheckedValue, indeterminateValue with formControl to checkbox field

<input type="checkbox" checkedValue="Y" uncheckedValue="N" indeterminateValue="I" [formControl]="status"/>

OR

<input type="checkbox" [checkedValue]="checkVal" [uncheckedValue]="unCheckVal" [indeterminateValue]="indetermVal" [formControl]="status"/>

Author

DarshanKumar L Sagar