Most, if not all, apps have a requirement to authenticate/authorize user access. We may argue that authentication and authorization are more of a server concern than a client concern, and that is correct. Still, the client side needs to adapt and integrate with the authentication and authorization requirement imposed by the server.
Any typical Angular application first loads partial views and then makes calls to pull data from the server and binds them to the views. Clearly, the views and the remote data API are the two assets that need to be secured.
To guard these resources, you need to understand how a typical application is secured on the server. There are primarily two broad approaches for securing any web applications: cookie-based authentication and token-based authentication. Each of them requires different handling on the client part. The next two sections describe how we can integrate with either of these approaches.