0

I have made a small SPA application using Angularjs (and Bootstrap). Have followed all the specification from anuglar site and other references on internet. To include the other pages dynamically in the main page it uses ng-view

However if we read about SPA architecture in general then it says all the pages are loaded at the beginning and the page NEVER refreshes.

But if we look minutely then just for a fraction of a second the page does refresh, have observed this not only in a demo app that I made, plus in few of the reference SPA using angularjs.

Just want to confirm my doubt, and make sure its not some mistake that I am doing.

Thanks.

Hemal
  • 265
  • 1
  • 7
  • 17
  • I'm assuming that you haven't set up routing, without setting up routes in angular your application it really isn't a SPA. – Mohammad Sepahvand Mar 05 '14 at 18:49
  • Ofcourse I did, that's not the problem. – Hemal Mar 05 '14 at 18:52
  • You must realise that some browsers show a flash for a second when the hash based rout changes, also it could be some CSS issues, like overflows that give that perception, best thing you can do is check your browsers network tab for requests, and to see what resources are loaded up front. – Mohammad Sepahvand Mar 05 '14 at 18:56
  • yes did that just now, only the new content/data is requested and as suggested below, its just the DOM changing and not a page refresh.. – Hemal Mar 05 '14 at 18:59

2 Answers2

1

What you are seeing is not a page re-load but simply new content being loaded into the DOM which gives the appearance of a refresh

PW Kad
  • 14,953
  • 7
  • 49
  • 82
  • Thank you for your reply. So it's a common behavior and there is nothing wrong in it. Cool! – Hemal Mar 05 '14 at 18:31
0

The page shouldn't be re-loading. What you're seeing is maybe the DOM changing.

I've also noticed that the favicon gets re-loaded when I change routes. This might make it seem like the page is reloading. I know this because I'm logging every request in the server which is a good way to find out what is being loaded when.

NicolasMoise
  • 7,261
  • 10
  • 44
  • 65
  • If you're using NodeJS and express you can use `app.use(express.logger('dev'));` to track all requests. – NicolasMoise Mar 05 '14 at 18:30
  • Thank you for your reply! I will try logging all the request and confirm it. – Hemal Mar 05 '14 at 18:34
  • YUP you are right, only the new content is requested, the existing things are never requested again, so its not the page refresh but just DOM changing!! – Hemal Mar 05 '14 at 18:54