[SOLVED] Aplication fails when accessing array index

Hi there !

When I want to access an array property, my application stops working.
Here is my code :

        // Find Current Projects
        var projects = $scope.user.cursus[0]['42'].projects;
        $scope.projects = [];
        ...

It fails on $scope.user.cursus[0].
If I use this:

        // Find Current Projects
        var cursus = $scope.user.cursus;
        var projects = cursus[0];
        $scope.projects = [];
        ...

it also fails, but without the var projects = cursus[0];, everything works well.

I tried with very simple arrays, and I got the same problem.

Here is a snapshot of my app with the problem:

And without:

Thanks a lot !

Ok I found the problem !
That was because $scope.user was empty because user is not yet logged-in, but the controller was called anyway in the background.

So problem resolved. :smile: