How do single page applications (like AngularJS) work?

How do single page applications (like AngularJS) work?