Getting Started with the Angular Developer's Guide

  • 2021-07-26 06:38:38
  • OfStack

What is Angular

AngularJS is the structural framework for dynamic Web applications. It allows you to use HTML as the template language and allows you to extend the syntax of HTML to express the components of your application clearly and concisely. AngularJS's data binding and dependency injection eliminate a lot of code that you have to write. All this happens in the browser, making it an ideal partner for any server technology.

Dynamic adaptation between dynamic applications and static documents is often solved in the following ways

1 library: 1 set of functions that are very useful when writing network applications. Your code is responsible for calling it in the library as it sees fit. E.g. jQuery Framework: A specific implementation of an Web application in which your code fills in the details. The framework is responsible for calling your code when it needs some application-specific. For example, durandal, ember, etc.

AngularJS takes another approach. It attempts to minimize the mismatch between the document center HTML and the impedance required by the application by creating a new HTML structure. AngularJS teaches the browser the new syntax through the construction of our call instructions. Examples include:

Data binding: {{}} DOM control structure for repeating, displaying, and hiding DOM fragments Support forms and form validation Attach a new behavior to an DOM element, such as DOM event handling Groups HTML as reusable components.

1 Complete Client Solution

AngularJS is not a single part of the overall puzzle of building the client side of an Web application. It handles all the DOM and AJAX glue code you've ever written and puts it in a well-defined structure. This led AngularJS to think about how to build an CRUD (create, read, update, delete) application. But while it's opinion, it also tries to make sure that its opinion is just a starting point that you can easily change. AngularJS provides the following out of the box:

1 cut required to build an CRUD application in a coherent collection: data binding, basic template directives, form validation, routing, deep linking, reusable components, and dependency injection Testability stories: unit testing, end-to-end testing, simulation and test harness Publishing applications starts with directory layout and test scripts.

What's nice about AngularJS

AngularJS simplifies application development by providing developers with a higher level of abstraction. Like any abstraction 1, it comes at the expense of flexibility. In other words, not every application is suitable for AngularJS. AngularJS is built with an CRUD application. Fortunately, CRUD applications represent most Web applications. In order to understand the benefits of AngularJS, it helps to understand when an application is not a good fit for AngularJS.

Games and GUI editors are examples of applications that use intensive and tricky DOM operations. These types of applications differ from CRUD applications and therefore may not be a good fit for AngularJS. In these cases, it is best to use a library with a lower level of abstraction, such as jQuery.

Zen of AngularJS

Register callbacks: Register callbacks will clutter your code, making it difficult to see the forest of the tree. Deleting common boilerplate code, such as callbacks, is a good thing. It greatly reduces the amount of JavaScript coding you have to do, and it makes it easier for you to see what your application does. Programmatically manipulating HTML DOM: Manipulating HTML DOM is the cornerstone of an AJAX application, but it is tedious and error-prone. By declaratively describing how UI should change when application state changes, you are freed from the low-level DOM operation task. Most applications written with AngularJS never need to operate DOM programmatically, though if you like. Data marshaling with UI: CRUD operations constitute the task of most AJAX applications. The marshalling data flow from the server to the internal object to the HTML form allows the user to modify the form, validate the form, display validation errors, return to the internal model, and then return to the server, creating a lot of template file code. AngularJS eliminates almost all of this boilerplate, leaving behind code that describes the overall flow of the application rather than all the implementation details. Writing large pieces of initialization code is just for the start: Usually you need to write a lot of pipes just to get a basic "Hello World" AJAX application to work. With AngularJS, you can easily boot your application with services that are automatically injected into your application in a dependency injection manner similar to Guice. This allows you to start developing functions quickly. As a reward, you can have complete control over the initialization process in automated tests.

Related articles: