- Earlier all the logic of JS was clubbed together in a single file along with code, CSS and html/JSP
- Then when the code grew it was harder to manage it
- Then came Angular which divided these things into its own file which caused easy to maintain
- Along with that, it provided build facilities, compilation
- Single-Page-Application(SPAs) is a web application that fits on a single page.
- All HTML,JS and CSS is retrieved with a single page load.
- Navigation between pages of the single page application is loaded within the same frame without refreshing the whole page.
- It uses HTML5 and AJAX to achieve the smooth page navigation between pages in SPAs
- Thus angular is used to make reactive front end applications which almost looks like mobile application i.e very fast everything happens instantly.
- Single Angular creates SPAs all the data that is rendered is not hitting server everytime, it is java script that renders that data on the page.
- And if we do need data from server then you just need to load it in the background so that user never leaves this experience of having a reactive web application.
- Internally when you click a page on SPAs the java script changes the DOM(Document Object Model) during runtime and renders it for you. That is the reason you never see the refresh icon on the browser spin.
Why to use Angular? Advantages of using Angular.
- Angular is mobile and desktop-ready, meaning you have one framework for multiple platform.
- Angular presents you not only the tools but also design patterns to build your project in a maintainable way.
- Angular uses java script but in a better way.Angular is built with TypeScript, which in turn relies on JS ES6. You don’t need to learn a totally new language, but you still receive features like static typing, interfaces, classes, namespaces, decorators etc.
- Angular already has lots of tools to start designing the applications right away, so you need to reinvent the wheel or write the code from the scratch.
- Angular promotes tight coupling between various components of the application.
- Angular does not tightly couple application logic and presentation logic which makes markup much cleaner and simpler.
- Angular is ment to be thoroughly tested and it supports both unit testing and end to end testing with the help of tools like Jasmine and Protractor.
- Angular is actively maintained and has large community and also has large 3rd party tools to support angular development.
When to go for Angular ?
- When you application is complex enough to justify it.
- When you want to test client side as well.
Angular 1 vs Angular 2+
- Angular 1 was the first angular framework which was developed base on java script.
- Later Angular 2+ i.e angular 2 and above versions came in which was a complete rewrite from angular 1, angular 2+ were base on Type script