1

I use this module https://github.com/rpocklin/angular-scroll-animate

i try create new attribute when-visible-class="animated fadeInUp" but i get error Directive: angular-scroll-animate 'when-visible' attribute must specify a function.

Please see module https://github.com/rpocklin/angular-scroll-animate

jsfiddle: jsfiddle.net/jgh9yumx/

1 Answer 1

0

The error that you obtain is because the attribute when-visible isn't a function. You need only see the code of angular-scroll-animate:

if (!scope.whenVisible || !angular.isFunction(scope.whenVisible())) {
    throw new Error('Directive: angular-scroll-animate \'when-visible\' attribute must specify a function.');
}

If you want to pass a string use '@', the '&' is only for functions.

In the next code extracted from the angular-scroll-animate, you can see that the whenVisible is a function.

scope: {
    whenVisible: '&',
    whenNotVisible: '&?',
    delayPercent: '=?',
    bindScrollTo: '@?'
}
Sign up to request clarification or add additional context in comments.

5 Comments

i'm already use @ for new attribute (whenVisibleClass: '@') In my html i set <div when-visible when-visible-class="fadeIn"></div> and i remove (!) in (if (scope.whenVisible || !angular.isFunction(scope.whenVisible())) ) but still showing error
In your html <div when-visible when-visible-class="fadeIn"></div> you need to set the when-visible attribute with a function and don't remove the !
but i was create new attribute whenVisibleClass: '@' and i set when-visible without function because it name directive please see jsfield jsfiddle.net/jgh9yumx/
But the when-visible attribute need the function mandatory. If you remove the function of when-visible attribute in your jsfiddle, you can see the same error..
Read the official notes of the directive: angular-scroll-animate , the first point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.