Socket
Socket
Sign inDemoInstall

angular-bootstrap-checkbox-group

Package Overview
Dependencies
5
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-bootstrap-checkbox-group

Simple checkbox group for Angular & Bootstrap app.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Angular library for the simple checkbox group element(s).

NPM

Table Of Contents

Installation

npm i angular-bootstrap-checkbox-group

Example

You should have installed Bootstrap in your app and then in your module's metadata, include AngularBootstrapCheckboxGroupModule in the imports array.

import { NgModule } from '@angular/core';
import { AngularBootstrapCheckboxGroupModule } from 'angular-bootstrap-checkbox-group';

@NgModule({
  imports: [
    AngularBootstrapCheckboxGroupModule
  ]
})
<!-- some.component.html -->

<checkbox-group
  [(values)]="values"
  [options]="optionsArrayOfString"
  [disabled]="disabled"
  [titleCaseOptions]="true"
  (allState)="handleAllClick($event);"
  (getClickedOptionKeyState)="handleOptionStateChange($event.key, $event.state);"
></checkbox-group>
<h5>Pizza for delivery:</h5>
[<span *ngFor="let value of values; index as i">'{{ value }}'{{ i !== values.length - 1 ? ", " : "" }}</span>]
<button *ngIf="!disabled" (click)="disabled = !disabled" class="btn btn-secondary">Disable</button>
<button *ngIf="disabled" (click)="disabled = !disabled" class="btn btn-primary">Enable</button>
// some.component.ts

export class MyComponent {
  public disabled: boolean = false;
  public readonly values: Array<string> = [];
  public optionsArrayOfString: Array<string> = [
    "neapolitan",
    "california style",
    "chicago deep dish",
    "new york thin crust"
  ];
  public optionsTupples: Array<[string, string]> = [
    ['neapolitan', 'Neapolitan'],
    ['california style', 'California Style'],
    ['chicago deep dish', 'Chicago Deep Dish'],
    ['new york thin crust', 'New York Thin Crust']
  ];
  public optionsObject: { [key: string]: string } = {
    'neapolitan': 'Neapolitan',
    'california style': 'California Style',
    'chicago deep dish': 'Chicago Deep Dish',
    'new york thin crust': 'New York Thin Crust'
  };

  public handleAllClick = (state: boolean): void => console.log(`state: ${state}`);

  public handleOptionStateChange(key: string, state: boolean): void {
    console.log(`key: ${key} - state: ${state}`);
  }
}

Versions

This library is using Angular 8.2 and tested on the host Angular app in which Bootstrap 4.3.1 was installed.

Attribute Definition Table

Attributes for <checkbox-group></checkbox-group> element:

AttributeDecoratorTypeOptionalDefault Value
disabledInputbooleanTruefalse
valuesInputArray<string | number>Falseundefined
valuesChangeOutputEventEmitter<Array<string | number>>TrueEventEmitter instance
optionsInputArray<string | number>Falseundefined
optionsInputArray<[string | number, string | number]>Falseundefined
optionsInput{ [key: string]: string | number }Falseundefined
titleCaseOptionsInputbooleanTruefalse
allStateOutputEventEmitterTrueEventEmitter instance
getClickedOptionKeyStateOutputEventEmitter<{ key: string | number, state: boolean }>TrueEventEmitter instance

Keywords

FAQs

Last updated on 25 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc