Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation range sliders only work after launching browser console

I'm coding an application using AngularJS v1.3.0 and Foundation 5.0.3. In one of my pages, I have a a couple of fieldsets, each one containing a few range sliders. Something like this

<fieldset ng-repeat="element in list" id="element_{{element.ID}}">
  <legend>Element: {{element.name}}</legend>
  <div ng-repeat="subelement in element.list" id="subelement_{{subelement.ID}}">
    <div class="small-10 medium-11 columns">
      <div class="range-slider round" data-slider="50">
        <span class="range-slider-handle"></span>
        <span class="range-slider-active-segment"></span>
      </div>
    </div>
  </div>
</fieldset>

The problem is I can't move the sliders until I open the browser console. It happens in Firefox and Chrome. I guess AngularJS defines some variables when the debug mode is activated in the browser, and this causes the problem. But I don't really know...

Any clues?

Many thanks in advance

like image 201
Jorge Arévalo Avatar asked Feb 24 '26 13:02

Jorge Arévalo


2 Answers

Try adding this run function to your angular app.

.run(function($rootScope) {
    $rootScope.$on('$viewContentLoaded', function () {
        $(document).foundation();
    });
});
like image 141
bill-lamin Avatar answered Feb 26 '26 11:02

bill-lamin


While this doesn't have the range slider in it yet, if you are using angular with foundation you should check out this: http://pineconellc.github.io/angular-foundation/

like image 34
scott Avatar answered Feb 26 '26 10:02

scott