I am trying to use this with angualar 4
See original GitHub issueI am using the angular cli. I have done npm install of ng2-nouislider and nouislider. later i done this. import { NouisliderModule } from ‘ng2-nouislider’; and in the angualr-cli.json i added the ~nouislider/distribute/nouislider.min.css"
this is my.ts import {Component, ViewChild, ElementRef, NgModule, VERSION} from ‘@angular/core’ import {BrowserModule} from ‘@angular/platform-browser’ import { NouisliderModule } from ‘ng2-nouislider’;
@Component({
selector: ‘my-app’,
template: <nouislider #slider [config]="someKeyboardConfig"></nouislider>
,
})
export class App {
@ViewChild(‘slider’, { read: ElementRef }) slider: ElementRef;
someKeyboardConfig: any = { behaviour: ‘drag’, connect: [true, true,true], start: [20, 40], keyboard: true, // same as [keyboard]=“true” step: 1, pageSteps: 10, // number of page steps, defaults to 10 range: { min: 0, max: 100 }, pips: { mode: ‘count’, density: 2, values: 6, stepped: true } }; ngAfterViewInit() { this.func(); }
func() { const connect = this.slider.nativeElement.querySelectorAll(‘.noUi-connect’); const classes = [‘c-1-color’, ‘c-2-color’, ‘c-3-color’]; console.log(connect.length); for ( let i = 0; i < connect.length; i++ ) { connect[i].classList.add(classes[i]); } } }
I cannot see the slider on html
in documentation of ng2-slider it says to add it in the system.config.js . and Unfortunately we donot have system.js in angular4 can you explain the steps how to use this library with webpack.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15
Top GitHub Comments
Initial handle value
start: [24, 34],
orsomeRange = [24, 34];
Tooltips - create own formatter for day/days postfix:
import { NouiFormatter } from "ng2-nouislider";
tooltips: [new MyFormatter, new MyFormatter],
While dragging
On Wed, Dec 20, 2017 at 5:20 PM, Chandra Sekhar Nandipati < chandu.pegasian@gmail.com> wrote: