danielcrisp / angular-rangeslider

Simple directive that creates a range slider for Angular, styled to match Bootstrap-styled form elements
danielcrisp.github.io/angular-rangeslider/
MIT License
223 stars 122 forks source link

Removed jQuery dependency #83

Open augnustin opened 9 years ago

augnustin commented 9 years ago

I can see there is another pull request on the same topic: https://github.com/danielcrisp/angular-rangeslider/pull/21

Changes here are really small:

I tested it in Chrome and FF and it works. I can't test it under IE because I'm using Linux. But offsetWidth is IE compatible.

Regarding findDivByClassName, I first used getElementsByClassName but it appeard not to be IE8 compatible so I went for a custom method, that only uses angular.find(tagName) which must be based on getElementsByTagName which is IE8 compatible.

Here it is:

            var filter = function(array, method) {
                var filteredArray = [];
                for (var i=0; i<array.length; i++) {
                    if (method(array[i])) {
                        filteredArray.push(array[i])
                    }
                }
                return filteredArray;
            };

            var findDivByClassName = function(element, className) {
                return angular.element(filter(element.find('div'), function(el){
                    return angular.element(el).hasClass(className);
                }));
            };

Hope this gets merged soon! :smile:

Awesome directive by the way!

danielcrisp commented 9 years ago

Amazing - thank you, will take a look soon

augnustin commented 9 years ago

I forgot a $document.find('body') in the $destroy.

Done. :)