Initializing bootstrap-slider as node module doesn't work


Greetings fellow meteorites!
Trying to get BootstrapSlider working in a blaze meteor template. I’m currently importing from a node module but the events such as slide, change don’t work even though I am following the syntax the documentation gives.

import 'bootstrap-slider';
import 'bootstrap-slider/dist/css/bootstrap-slider.min.css';

  let currentSlider =  this.$('.slider').slider({
    min            : 0,
    max            : 100,
    step           : 1,
    value          : 5 ,
    tooltip        : 'show'
  const something = ()=>{
  currentSlider.slider().on('slide', something).data('slider');
   currentSlider.slider().on('change', function(changeEvt){
   console.log(`CURRENT SLIDER JQUERY OBJECT ? : ${currentSlider instanceof jQuery}`)

I’m just following the syntax I see here

But it’s not working. Anybody see what I’m doing wrong ?

Appreciate the help big time :slight_smile: Alex


It’s very strange but the issue was stemming from onRendered I had to change the line
let currentSlider = this.$('.slider').slider({
let currentSlider = Template.instance().$('.slider').slider({


onRendered requires that you use the ES5 syntax,not ES2015 “fat arrow” syntax in order that the template context (this) is correctly set up.

Template.slider.onRendered(function() {

Although, as you discovered, Template.instance() can be used to get a reference to the context.


Ah that makes much more sense now! Overlooked this. Thank you.


I can’t see how to make the slider reactive. In this instance you define it in the template with an input but then when you call .slider() in the template onRendered function the input is replaced with a tree of divs which overwrites any reactive data-slider-value or value attributes that you might have provided. Is there a way of making the slider reactive?

Reactive bootstrap-slider