Ionic-Material icon indicating copy to clipboard operation
Ionic-Material copied to clipboard

Uncaught TypeError: Cannot read property 'className' of undefined

Open desenvolvedorindie opened this issue 9 years ago • 25 comments

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

I think just a undefined check

Version: 0.4.2

desenvolvedorindie avatar May 22 '15 03:05 desenvolvedorindie

Same problem

germanferrero avatar May 22 '15 17:05 germanferrero

thanks for finding this

rbutera avatar May 22 '15 17:05 rbutera

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

do-web avatar May 23 '15 20:05 do-web

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

Thanks

jjaybrown avatar May 27 '15 08:05 jjaybrown

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);

desenvolvedorindie avatar May 28 '15 02:05 desenvolvedorindie

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

ericraio avatar May 28 '15 18:05 ericraio

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"

andysdesigns avatar Jun 18 '15 03:06 andysdesigns

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();
});

desenvolvedorindie avatar Jun 18 '15 14:06 desenvolvedorindie

:+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);

});

sameera207 avatar Jun 21 '15 22:06 sameera207

:+1:

desenvolvedorindie avatar Jun 21 '15 22:06 desenvolvedorindie

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

andresetevejob avatar Aug 28 '15 14:08 andresetevejob

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

KusumaScriptbees avatar Sep 08 '15 06:09 KusumaScriptbees

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).

kashban avatar Sep 10 '15 08:09 kashban

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

hectorpalmatellez avatar Sep 11 '15 21:09 hectorpalmatellez

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 [email protected]:

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 .

andresetevejob avatar Sep 12 '15 10:09 andresetevejob

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

AhsanAyaz avatar Sep 19 '15 00:09 AhsanAyaz

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.

kashban avatar Sep 20 '15 06:09 kashban

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

beerni avatar May 13 '16 17:05 beerni

+1

ahayder avatar Nov 30 '16 12:11 ahayder

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

amitpatil321 avatar Dec 29 '16 17:12 amitpatil321

+1

janziemba avatar Jan 27 '17 15:01 janziemba

any updates/idea how to solve this issue

alkahtani avatar Feb 05 '17 09:02 alkahtani

Hi Any Update on this issue ?

Arvind6353 avatar Jul 01 '17 17:07 Arvind6353

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" [email protected] 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 .

amitpatil321 avatar Jul 01 '17 18:07 amitpatil321

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

Arvind6353 avatar Jul 05 '17 02:07 Arvind6353