Why would I use Angular? [closed]

From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there’s its double binding magic.

But why would I use it instead of a backend solution (like Rails) that builds the view in the backend and serves it to the user, with everything in place already? What are the use cases?

TLDR;

Angular helps you deal with the complexity inherent in rich user interfaces. As UI complexity increases, the traditional model of generating pages on the server gets much more complex. Angular lets you decompose your UI into manageable chunks, and allows you to separate the UI from the implementation. This makes server-side page generation a great deal easier, but Angular really comes into its own when you make the move to pure javascript-based applications. A good example of such an application is Trello.

The long story

Angular isn’t really targeted at sites that you can comfortably implement by generating everything on the server, and sending it across. Furthermore, whilst that is a perfectly good approach that works for many sites and applications around the internet, it becomes increasingly complex (thus difficult) to keep that approach working as you try to increase the level of interactivity in your site.

Ultimately the way you solve this is by pushing your UI more and more into the Javascript side of the equation. Angular lets you break your UI up into components, giving you clear separation between the look-and-feel, and the how-it-works. You can then build fairly simple pages on the server, and the JS front end is used to create a rich UI that makes separate calls back to your server for the data they need.

There comes a point, though, where all you want to do is server a stub page that loads a completely javascript-based application. Probably the most well known example of the sort of use-case where Angular really shines is Trello (it uses Backbone, not Angular, but it is the same use-case). There is a site http://builtwith.angularjs.org/ which has more example sites that use Angular.

So the short answer? Angular makes it easier to create rich, highly interactive user interfaces by letting you decompose your UI into components, and ultimately go completely javascript.

4

It is about making more responsive user interfaces. The double binding, dependency injection and so on makes it possible to create dynamic pages quite easily. You can write directives in Angular which gives you a declarative way to construct a view.

As an example, in a current project we have a view that uses several hundred lines of JavaScript code in order to make a responsive user experience. Even so the page is a bit buggy and very difficult to maintain. We started looking around for a better option and looked at backbone.js and knockout.js. Eventually we tried Angular. We were able to create a much more responsive and maintainable page with just a few lines of code. Gone was all the DOM manipulation code. Gone was all the clunky backend view creations that had to be fetched and inserted at the right places. Gone was all the code that was written to keep the model and the view in sync. With that experience the decision to move to Angular became easier and so far we have not regretted it.

1

Angular is for developing Single Page Applications, it helps with providing a solid skeleton for your app. It is also good with forms, not so good with complex crowded UIs with lots of data. Two-way data binding is “magic” at first but you have to be aware that most recent frameworks (including Angular 2 itself) move away from two-way data binding for a more simple Data flow down / event flow up approach (telling that story would be too long here).

I also have to warn you that Angular doesn’t have a definite way of doing things and sometimes offers too many ways to skin a cat, which can make the learning curve steeper. Also if you want to scale an Angular app, you’ll have to understand its internal mechanics and possible impact on performance. Once you do that, and once you establish consistent solid design patterns, the sky is the limit. But you need to dedicate time to it.

That said, your question seems to be more about what are the use cases of SPAs rather than Angular itself.

The use cases of Single Page Applications are for having web apps with robust UI/UX and overall better application feel. By not having to reload your page you save on rendering time and bandwidth. You also separate data and presentation which is awesome. Your application becomes:

  • Static files, including your index.html
  • A REST API serving data
  • A data-driven front-end application

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật