zachfitz / Ionic-Material

Material Design style and animations for Ionic
http://ionicmaterial.com
Other
2.9k stars 904 forks source link

Uncaught TypeError: Cannot read property 'className' of undefined #68

Open desenvolvedorindie opened 9 years ago

desenvolvedorindie commented 9 years ago

Line 773: animateSlideInRightDom[0].className += ' done';

I think just a undefined check

Version: 0.4.2

germanferrero commented 9 years ago

Same problem

rbutera commented 9 years ago

thanks for finding this

do-web commented 9 years ago

Same problem, big bug, cant use this plugin because of the bugs

jjaybrown commented 9 years ago

@wfcreations can you provide a full stack trace and possibly a codepen so I can attempt to re-create the issue and fix.

Thanks

desenvolvedorindie commented 9 years ago

There's some Ionic-Material CDN?

Work fine:

ionicMaterialMotion.fadeSlideInRight();

<div class="list animate-fade-slide-in-right">
    <div class="item card item-text-wrap">
    ...
    </div>
</div>

But when I add ng-repeat

ionicMaterialMotion.fadeSlideInRight();

<div class="list animate-fade-slide-in-right">
    <div class="item card item-text-wrap" ng-repeat="card in cards">
        ...
    </div>
</div>

I receive: Uncaught TypeError: Cannot read property 'className' of undefined(anonymous function) @ _motion.js:464

I don't know if I need wait something

Solve when I put inside of $timeout

$timeout(function () {
    ionicMaterialMotion.fadeSlideInRight();
}, 300);
ericraio commented 9 years ago

+1 i had this issue, throwing it into a timeout fixed it. looks like a race condition with ng-repeat

andysdesigns commented 9 years ago

same issue here and no luck for solution even after adding $timeout() ( might wanna get myself dirty for this one to work as i cannot use the plugin ).

as @ericraio mentioned, "looks like a race condition with ng-repeat"

desenvolvedorindie commented 9 years ago

I suppose your ng-repeat data need finish to load before animation effect

Example:

$http.get('/someUrl').success(function(data, status, headers, config) {
    ionicMaterialMotion.fadeSlideInRight();
});
sameera207 commented 9 years ago

:+1: for the timeout, Had the same issue and throwing the timeout fixed it. One concern through, What happens if the list takes more than 300 to load (for API delay etc..) ?

Ended up doing both @wfcreations suggested,

$http.get('/someUrl').success(function(data, status, headers, config) {

   $timeout(function () {
       ionicMaterialMotion.fadeSlideInRight();
   }, 300);

});
desenvolvedorindie commented 9 years ago

:+1:

andresetevejob commented 9 years ago

I have the same problem on my first page Uncaught TypeError: Cannot read property 'className' of undefined

KusumaScriptbees commented 9 years ago

Same problem not able able to solve. Help would be grateful.

kashban commented 9 years ago

Throwing me into the crowd. Same issue here and neither of the two solutions proposed worked for me ($timeout and calling it from within the callback after the data has been loaded).

hectorpalmatellez commented 9 years ago

Same problem here, couldn't get to fix it.

andresetevejob commented 9 years ago

Hi All,

I want to know if ionic material design work with android 4.0 and 4.2 because I have used it in the project and it not works well

2015-09-11 22:04 GMT+01:00 Héctor Palma Téllez notifications@github.com:

Same problem here, couldn't get to fix it.

— Reply to this email directly or view it on GitHub https://github.com/zachsoft/Ionic-Material/issues/68#issuecomment-139660860 .

AhsanAyaz commented 9 years ago

I have the same problem. Timeout solves the problem but it is not neat at all. The list can vary and ng-repeat can take different time periods to render items (in which the code crashes) Please fix this asap, i look forward to implement ionic material into my project

kashban commented 9 years ago

I found a way to solve this:

https://github.com/zachsoft/Ionic-Material/issues/43

There is only one caveat with filters, though: The filter is applied before the animation starts, so for a short time the old list is visible while the filtered entries are removed, then the animation kicks in, blanks the list and the filtered list animates in.

So if you're not using filters on your ngRepeat, the solution from that link'll do. For filters I guess Ionic Material has to provide some solution.

beerni commented 8 years ago

Same problem as mentioned. I include the timeout and nothing, the classname error is still there

ahayder commented 7 years ago

+1

amitpatil321 commented 7 years ago

I also added timeout with 10000ms and even 20000 ms still error is there. Totally helpless now :( @wfcreations : Please give us some more clue.

janziemba commented 7 years ago

+1

alkahtani commented 7 years ago

any updates/idea how to solve this issue

Arvind6353 commented 7 years ago

Hi Any Update on this issue ?

amitpatil321 commented 7 years ago

Try setting a timeout. Initialise library 3 to 4 second later after app loads or if you are using on lists then after list completely loads.

On Jul 1, 2017 11:09 PM, "Arvind" notifications@github.com wrote:

Hi Any Update on this issue ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zachfitz/Ionic-Material/issues/68#issuecomment-312445603, or mute the thread https://github.com/notifications/unsubscribe-auth/AC3j73aQVo-6pQ4426RTxS6xZcgQ0N0Pks5sJoRSgaJpZM4EkXcR .

Arvind6353 commented 7 years ago

I tried setting timeout , but still facing the same error intermittently.

I am using firebase to get the list of items to show to the user.

I have set the timeout to 3000 . But still facing this issue.

I don't think I can use callbacks here since am using firebase and syncing the data directly.

Let me know if you have any other solution