Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Range slider is not working #99

Closed
janu1428 opened this issue Aug 16, 2017 · 6 comments
Closed

Range slider is not working #99

janu1428 opened this issue Aug 16, 2017 · 6 comments

Comments

@janu1428
Copy link

Hi,

I am trying to use range slider. I have given connect attribute as true, but still able to see only single slider.
Kindly let me know what am i doing wrong. Below is my html tag

<nouislider [connect]="true" [min]="0" [max]="1500" [step]="100" [(ngModel)]="someRange" (ngModelChange)="rangeValueChanged($event)">

@scubed2010
Copy link

scubed2010 commented Aug 19, 2017

I'm having the same issue.

I'm running Angular CLI 1.3 with Angular 4.3.4.

Are there plans to update this package for Angular4?

@kiqq
Copy link

kiqq commented Aug 24, 2017

Make sure type of someRange is number[]:
someRange: number[] = [100, 1000];

[connect]="true" sets background-color for space in chosen ranges, more info:
https://refreshless.com/nouislider/slider-values#section-handles-multiple

@fergalddaly
Copy link

Any chance of somebody providing a proper description on the steps to use this with Webpack?
Think that is missing from the docs.
A lot of issues being logged.

@kiqq
Copy link

kiqq commented Sep 7, 2017

I'm not so sure if I'm a proper person to do this (not much experience), but let me rewrite README's parts that applies to Angular 4/5 here in (maybe) simpler to understand form:

  1. Run in terminal in your project's directory: npm i --save nouislider ng2-nouislider
  2. Import css styles for slider (choose a or b):
    a) to projectPath/src/styles.css add: @import "~nouislider/distribute/nouislider.min.css";
    b) in projectPath/.angular-cli.json change:
"styles": [
        "styles.css"
],

to

"styles": [
        "../node_modules/nouislider/distribute/nouislider.min.css",
        "styles.css"
],

and rerun ng serve if webserver was started.
3. In projectPath/src/app/app.module.ts:

import { NouisliderModule } from 'ng2-nouislider'; //add this!!!!!!

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    NouisliderModule //add this!!!!!
})
export class AppModule {
}
  1. Now we can use <nouislider></nouislider> component in our own components.
    Check demos to see how: http://tb.github.io/ng2-nouislider/
    Check nouislider site to see all possibilities we can use: https://refreshless.com/nouislider/

@fergalddaly
Copy link

The issue that I had related to the css.
I eventually figured out that 2 (b) was the issue.
Good to have a guide.
I'm sure others will see this and it will resolve their issue.
Slider is working great now.

@kiqq
Copy link

kiqq commented Sep 8, 2017

You are welcome. Great to know it solved your problem. I wish you happy sliding :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants