In this tutorial you will learn about the What Is Single Page Application In Angularjs? and its application with practical example.
What Is Single Page Application In Angularjs?
Single page application (SPA) is a web application that is contained in a single page. In a single page application all our code (JS, HTML, CSS) is loaded when application loads for the first time. Loading of the dynamic contents and the navigation between pages is done without refreshing the page. Single page application (SPA) is usually created using javascript based front-end web application framework.
What Is AngularJS?
AngularJS is one of the widely used front-end web application framework used for building Single Page Application (SPA). It extends the traditional HTML with new attributes and data-binding components that enable us to serve dynamic page content. In Our Next article, we’ll learn how to build a Single Page Application (SPA) using AngularJS Routing and AngularJS Template.
What Are Single Page Application Advantages (Pros)
Building any application as single page application will comes with significant number of benefits. In this article, we will talk about some of the key single page application advantages listed as below –
Improved User Experience :- Single page application bring a much-improved experience to the user.
No Page Refresh :- In a Single Page Application, there is no need to refresh the whole page for every request, all our code (JS, HTML, CSS) is loaded when application loads for the first time. Loading of the dynamic contents and the navigation between pages is done without refreshing the page.
Faster and Responsive :- Single Page Applications are faster because they require less bandwidth, and no full page refreshes when user navigates through the application.
Caching capabilities :- Single Page Applications comes with caching capabilities which allows it to cache any local data effectively. Single Page Application sends single request to server and then stores all the data it receives locally. Which it can use it and work even offline.
What Are Single Page Application Disadvantages (Cons)
While building single page application will comes with significant number of benefits. It also has some disadvantages that must be considered while building a single page application –
Javascript Must Be Enabled :- Single Page Application requires javascript to enabled. Fortunately, almost everyone has javascript enabled.
Initial load is slow :- All our code (JS, HTML, CSS) is loaded when application loads for the first time which cause it slow initially.
Complex to build :- You must have understanding of single page application architecture and front end technologies. It also requires you to have pretty much javascript knowledge for building single page applications.
Search Engine Optimization(SEO) :- Single Page Applications are not considered as much seo friendly. Fortunately, Google and Bing started indexing Single Page Applications.