The Angular framework from Google is one of the most popular web frameworks in use today. It is a robust platform that allows developers to build responsive web apps and single-page apps (SPAs) very easily. However, there are some negative aspects to these types of web apps. Primarily, search engines have a hard time indexing these types of web apps. Web scrapers (used for things such as Facebook sharing previews) cannot scrape dynamic data that may be displayed with different pages/views. So what can you do if you love working with Angular and love the benefits of Angular SPAs, but want the benefits of SEO and social previews? Welcome, Angular Universal!
Angular Universal brings the ability to render your Angular apps on the server-side similar to most other dynamic web frameworks. But wait, isn’t that the main reason we use Angular? So that we don’t have to depend on servers and have the latency of refreshing pages between different web pages? Well yes, but Angular Universal brings you the best of both worlds!
Angular Universal allows for a precompiled initial view to be sent from the server. This keeps the initial page load time shorter for the end-user compared to a normal Angular web app. Normal Angular web apps take a few seconds to load on the initial request before the user can even view or interact with the page. After the initial request, the majority of all subsequent requests are handled directly in the browser.
Sharing Via Social Media
Hopefully, you can now see what Angular Universal is all about and all the benefits it brings when coupled together with a traditional Angular web app! Have you used Angular Universal in any of your web apps? If so, what did you find was the biggest benefit for your apps? Let me know in the comments!