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

when-visible and when-not visible not working #24

Open
holuwaseun opened this issue May 15, 2017 · 1 comment
Open

when-visible and when-not visible not working #24

holuwaseun opened this issue May 15, 2017 · 1 comment

Comments

@holuwaseun
Copy link

Hi,

I'm trying to use this directive, but for some reason, the functions I supplied to the when-visible and when-not-visible attributes of the element fail to run. Below is my source. Please any help will be greatly appreciated. Thanks

HTML
when-visible="animateElementIn" when-not-visible="animateElementOut"

Angular Controller
$scope.animateElementIn = ($el) => { $el.removeClass('hidden'); $el.addClass('animated fadeInLeft'); };

$scope.animateElementOut = ($el) => { $el.addClass('hidden'); $el.removeClass('animated fadeInLeft'); };

Also, if i change
when-visible="animateElementIn"

to
when-visible="animateElementIn()"

I get an error that says
angular.js:14525 TypeError: Cannot read property 'removeClass' of undefined at b.$scope.animateElementIn (http://localhost/wgr/public/app/controllers/wgr.controller.js:9:16) at fn (eval at compile (http://localhost/wgr/node_modules/angular/angular.min.js:239:266), <anonymous>:4:168) at m.d.(anonymous function) [as whenVisible] (http://localhost/wgr/node_modules/angular/angular.min.js:87:238) at new controller (http://localhost/wgr/bower_components/angular-scroll-animate/dist/angular-scroll-animate.js:82:61) at Object.invoke (http://localhost/wgr/node_modules/angular/angular.min.js:44:171) at S.instance (http://localhost/wgr/node_modules/angular/angular.min.js:94:35) at n (http://localhost/wgr/node_modules/angular/angular.min.js:69:42) at g (http://localhost/wgr/node_modules/angular/angular.min.js:61:496) at g (http://localhost/wgr/node_modules/angular/angular.min.js:62:12) at g (http://localhost/wgr/node_modules/angular/angular.min.js:62:12) "<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-all-0 ng-scope" ui-view="" data-ng-animate="1">"

@rpocklin
Copy link
Owner

Does the example work when you checkout this codebase and run npm i && grunt serve?

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