First entry Angularjs

Source: Internet
Author: User

Angularjs is an excellent front-end JS framework that has been used by Google for a variety of products. Angularjs has many features, the core of which is MVVM, modularity, automated bidirectional data binding, semantic tagging, dependency injection, and more.

Angularjs is designed to overcome the lack of HTML in building applications. HTML is a good declarative language for static text presentation design, but it seems weak to build a Web application. So I did some work (you can also think of it as a gimmick) to get the browser to do what I want.

Angularjs uses a different approach, and it tries to make up for the drawbacks of HTML itself in building applications. Angularjs allows the browser to recognize the new syntax by using the structure we call directives. For example:

1. Use double curly braces {{}} syntax for data binding;

2. Use the DOM control structure to iterate or hide the DOM fragments;

3. Support the verification of forms and forms;

4. Ability to associate logical code with related DOM elements;

5. HTML can be composed of reusable components.

Solution:

Angularjs is trying to be a client-side solution for Web applications. This means it's not just a small part of your web app, it's a complete client-side solution. This will allow ANGULARJS to be "stubborn" when building a crud (adding create, querying retrieve, updating updates, deleting delete). However, while it is "stubborn", it can still ensure that its "stubbornness" is just the starting point for your application, and you can still be flexible. Some of the outstanding things about Angularjs are as follows:

1. All that is possible to build a Urud application includes: Data binding, basic template identifiers, form validation, routing, deep linking, component reuse, dependency injection.

2. Testing aspects include: unit testing, end-to-end testing, simulation and automated testing frameworks.

3. A seed app with a catalog layout and test scripts as a starting point.

Using callbacks: The use of callbacks can disrupt the readability of your code, make your code fragmented, and hard to see the business logic of the future. Removing some common code, such as callbacks, is a good thing. Drastically reducing the code you have to write because of the JavaScript language design will allow you to see the logic of your application more clearly.

Manually write code to manipulate DOM elements: manipulating the DOM is a fundamental part of AJAX applications, but it is always "cumbersome" and error-prone. The UI interface class, described declaratively, changes as the application state changes, freeing you from writing low-level DOM manipulation code. In most applications written in Angularjs, developers do not have to write their own DOM code, but you can write them if you want.

Read and write data to the UI interface: A large part of AJAX applications is CRUD operations. A classic process is to set the server data into an internal object, then the object into an HTML form, the user modifies the form and then verify the form, if the error is displayed again, then the data is re-organized into internal objects, and then returned to the servers. There is too much code to repeat in this process, so that the code appears to always describe the entire execution process of the application, rather than the specific business logic and business details.

Before you start, you have to write a lot of basic code: usually you need to write a lot of basic code to implement a "Hello world" application. With ANGULARJS, it will provide services that make it easy for you to formally start writing your app, and these services are automatically added to your app in a guice-like Dependency-injection-based dependency injection, This allows you to quickly enter the specific development of your application. In particular, you can master the initialization of automated tests.

Angularjs expression:

The AngularJS expression is written in double curly braces: {{expression}}.

AngularJS expressions bind data to HTML, which is similar to the Ng-bind directive.

AngularJS will "output" the data where the expression is written.

AngularJS expressions are much like JavaScript expressions: They can contain literals, operators, and variables.

This is my understanding of Angularjs, next time to explain in detail the specific usage.

First entry Angularjs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.