jhawes
jhawes

Reputation: 2364

Angularjs page initial load very slow

I'm pretty new to Angular and my page's initial load is extremely slow. After the initial load the navigation panel, which controls which products to include in the 'ng-repeat' runs perfect.

When I remove the script that begins my Angular JavaScript code it loads perfect again, so it may have something to do with how I coded that.

The first 3 tabs (including their drop-downs) are working. The search engine in the sidebar is incredibly slow too.

Angular JavaScript

(function (){
    var app = angular.module('craneStore', []);

    app.controller('StoreController', function(){
        this.products = craneStuff;
    });

    app.controller('TabController', function(){
        this.tab = 'featured';

        this.setTab = function(newValue){
            this.tab = newValue;
        };

        this.isSet = function(tabName){
            return this.tab === tabName;
        };
    });

    var craneStuff = [{

           *All my expressions *

    }];
})();

I know this alone isn't enough, so here's a link to the area I'm testing this in:

My Test Area

Upvotes: 1

Views: 3976

Answers (1)

Mark
Mark

Reputation: 92440

The main culprit is the ENORMOUS images you are sending to the page. Your javascript is waiting for these images to load, which is not unreasonable behavior unless the images are gigantic. Here's an example of one of the images on the site:

http://craneshit.com/images/products/standards/B30-28-10.jpg

Unless you really need to send 3200 pixel images, you should resize them.

Upvotes: 3

Related Questions