ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

Random issue when using using $ocLazyLoad in ui-router resolve #338

Open mahmoudmy opened 8 years ago

mahmoudmy commented 8 years ago

I use ocLazyLoad with ui-router:

.state('view', {
        url: '/view/:id',
        parent: 'app',
        templateUrl: 'app/view/view-template.html',
        controller: 'viewCtrl',
        abstract: true,
        resolve: {
          viewResolve: function(Restangular, $stateParams) {
            return Restangular.one('qInfo', $stateParams.id).withHttpConfig({
              cache: false
            }).get();
          },
          viewJsFile: ['$ocLazyLoad', function($ocLazyLoad) {
            return $ocLazyLoad.load({
              name: 'viewCtrl',
              files: ['resources/scripts/view.js']
            });
          }]
        }        
      })

Sometimes I experience browser freezing (Not Responding appears on title bar) for about 3-5 seconds, then the js file loads successfully and app continues working fine! I checked the timing for loading view.js: in the normal situation it's 3 ms (milisecconds), but in the error situation it's about 500 ms! Any ideas?

ocombe commented 8 years ago

it loads js files by appending Githubissues.

  • Githubissues is a development platform for aggregating issues.