Dependencies

This repository contains a Angular v2+ Bootstrap-styled Toggle that can be used as a standalone toggle or can convert checkboxes into UI toggles. As a result no dependency on jQuery or Bootstrap's JavaScript is required. The only required dependencies are:

Supported browsers

We strive to support the same browsers and versions as supported by both Bootstrap 4 and Angular, whichever is more restrictive. Check browser support notes for Angular and Bootstrap.

Our code is automatically tested on all the supported browsers.

Installation

After installing the above dependencies, install ngx-toggle via:
npm install --save ngx-toggle

Once installed you need to import our main module.

import {NgxToggleModule} from 'ngx-toggle';

The only remaining part is to list the imported module in your application modules that make use of the components in this library:

import {NgxToggleModule} from 'ngx-toggle';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgxToggleModule, ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

SystemJS

If you are using SystemJS, you should also adjust your configuration to point to the UMD bundle.

In your systemjs config file, map needs to tell the System loader where to look for ngx-toggle:

map: {
  'ngx-toggle': 'node_modules/ngx-toggle/ngx-toggle/bundles/ngx-toggle.js',
}

Getting Help

Please, do not open issues for the general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on StackOverflow where the community at large are looking at questions tagged with ngx-toggle.

StackOverflow is a much better place to ask questions since:

To save your and our time we will be systematically closing all the issues that are requests for general support and redirecting people to StackOverflow.