Skip to content
This repository was archived by the owner on Oct 5, 2019. It is now read-only.

Conversation

@makzee
Copy link
Contributor

@makzee makzee commented Apr 29, 2016

This directive doesn't work for application built on AMD or CommonJs. If you take a look at source of bootstrap-slider.js (The actual plugin not the direcitve).

    if (typeof define === "function" && define.amd) {
        define(["jquery"], factory);
    } else if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === "object" && module.exports) {
        var jQuery;
        try {
            jQuery = require("jquery");
        } catch (err) {
            jQuery = null;
        }
        module.exports = factory(jQuery);
    } else if (window) {
        window.Slider = factory(window.jQuery);
    }

Your code depends on window.Slider and hence only works in case if you are not using any AMD or CommonJs loader. This commit fixes the issue.

@seiyria seiyria merged commit 4b02639 into seiyria:master Apr 30, 2016
@seiyria
Copy link
Owner

seiyria commented Apr 30, 2016

Thanks!

@@ -1,3 +1,13 @@
(function(factory) {
if (typeof define === 'function' && define.amd) {
define(['angular', 'bootstrapSlider'], factory);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 'bootstrapSlider' and not 'bootstrap-slider' like in the original bootstrap-slider project ???

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's more annoying to type ['bootstrap-slider'].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants