Google Chrome initial loading of AngularJS application -
i have angularjs application reachable under url:
and has strange behaviour: write url of application url input , press enter, google chrome takes 20 seconds load without opened developer tools (f12), if open developer tools takes 5 seconds, ok. other browsers opera, firefox ie takes 5 seconds initial load of application.
my question if has explanation strange behaviour?
the problem slow response time because have many file loading. application loads html file ng-include
, doesn't start loading file before scripts loaded. suggest bundling scripts 1 file. cut loading time @ least in half. plugin bundles libraries bower 1 file https://www.npmjs.com/package/gulp-bundle-assets.
also practice putting static html in html file later replaced content want
<body ng-include='app/core/aposoft.html'> <div> app initializing </div> </body>
with html let user know app loading, can style better css. put scripts below </body>
tag. enable caching on server scripts.
this way have single file loading scripts , initial html show user app initializing , next time same user opens app fast.
note: avoid problem cache when have new version should use https://www.npmjs.com/package/gulp-useref
Comments
Post a Comment