Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with ng-repeat #1

Closed
carrierdown opened this issue Nov 8, 2013 · 1 comment
Closed

Compatibility with ng-repeat #1

carrierdown opened this issue Nov 8, 2013 · 1 comment

Comments

@carrierdown
Copy link

Thanks for the directive. However, I discovered that it does not work if the content you are trying to show contains an ng-repeat (the ng-repeat doesn't trigger). I've fixed the code, feel free to update it:

.directive('slideable', function () {
    return {
        restrict: 'C',
        compile: function (element, attr) {
            // wrap tag
            var contents = element.html();
            element.html('<div class="slideable_content" style="margin:0 !important; padding:0 !important" >' + contents + '</div>');

            return function postLink(scope, element, attrs) {
                // default properties
                attrs.duration = (!attrs.duration) ? '1s' : attrs.duration;
                attrs.easing = (!attrs.easing) ? 'ease-in-out' : attrs.easing;
                element.css({
                    'overflow': 'hidden',
                    'height': '0px',
                    'transitionProperty': 'height',
                    'transitionDuration': attrs.duration,
                    'transitionTimingFunction': attrs.easing
                });
            };
        }
    };
})
@EricWVGG
Copy link
Owner

EricWVGG commented Dec 7, 2013

Odd, I have had no issues with it working in ng-repeat. Regardless, your use of the compile function is superior, so I've added it. Thanks!

@EricWVGG EricWVGG closed this as completed Dec 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants