Giter Site home page Giter Site logo

Change limit dynamically about ng2-nouislider HOT 7 CLOSED

tb avatar tb commented on September 18, 2024
Change limit dynamically

from ng2-nouislider.

Comments (7)

IgorceJovanoski avatar IgorceJovanoski commented on September 18, 2024 1

Hey,
just a a shout for changing dynamically the range for angular2 or higher, I used the advices with the view child and update options tl;dr;
front:
<nouislider [connect]="true" [step]="1" [min]="modelMonthlyCost.min" [max]="modelMonthlyCost.max" [(ngModel)]="monthlyCostRange" [ngModelOptions]="{standalone: true}" (change)="changeMonthlyCost()" #monthlyCostSlider></nouislider>

back:
@ViewChild('monthlyCostSlider') public monthlyCostSlider: NouisliderComponent
.
.
.
this.monthlyCostRange = [+newModelMonthlyCost.min, +newModelMonthlyCost.max];
if (this.monthlyCostSlider.slider) this.monthlyCostSlider.slider.updateOptions({ start: [+newModelMonthlyCost.min, +newModelMonthlyCost.max], range: { min: +newModelMonthlyCost.min, max: +newModelMonthlyCost.max } });

Hope it helps, works for me

from ng2-nouislider.

olehtalanov avatar olehtalanov commented on September 18, 2024 1

You can do like this:
this.priceSliderRef.slider.set([+valueToSet1, +valueToSet2]);

from ng2-nouislider.

tb avatar tb commented on September 18, 2024

@smikey It will require adding https://angular.io/docs/ts/latest/api/core/index/OnChanges-class.html and using https://refreshless.com/nouislider/more/#section-update Can you do PR with it?

from ng2-nouislider.

jovanialferez avatar jovanialferez commented on September 18, 2024

see my comment here: #55

from ng2-nouislider.

davejohncole avatar davejohncole commented on September 18, 2024

I have hit the same limitation with this component, but as I have just started using angular so do not have the skills necessary to fix this myself.

Looking at the documentation here https://refreshless.com/nouislider/more/ it appears that the wrapped control supports the capability.

from ng2-nouislider.

adityaitsrkr avatar adityaitsrkr commented on September 18, 2024

Hi Talanoff
Can you pls post ur code.
How r u getting the nouislider objects.
Like update option.
Can you pls help

from ng2-nouislider.

adityaitsrkr avatar adityaitsrkr commented on September 18, 2024

I got it working. Thank you

from ng2-nouislider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.