Angularjs compiler, angularjscompiler

Source: Internet
Author: User

Angularjs compiler, angularjscompiler

Angular HTML compiler allows developers to customize the new HTML syntax. Compiler allows us to attach any HTML element or attribute, or even new HTML tags and attributes (such as <beauul ul girl = "cf"> </beautiful>. Angular calls these additional actions direves ves.


HTML has a lot of predefined HTML style structures dedicated to formatting static documents [tell the browser how to display the marked content]. Assuming that the content of a tag needs to be centered, you only need to add the attribute align = "center" to the tag. This is the declarative language.

However, declarative languages also have limitations, for example, they cannot process syntaxes beyond the predefined scope. Angular is pre-bound to some direves ves [attributes] that are helpful for building applications. Of course, you can also build your own unique directive. These created directive will become our own "specific domain language"

Note that these compilations only occur on the browser end, without the need for servers and pre-compilation processes.


Ii. Next we will introduce compiler in detail

As a angular service, compiler is responsible for traversing the DOM structure and searching for attributes. The compilation process is divided into two steps:

1. Compile: traverses the DOM node tree and returns a link function.

2. link: bind ves to a scope to create a view, and update and display the scope and view as long as a slight change occurs, any user's changes to the template will be reflected in the scope model (two-way data binding), so that the scope model can reflect the correct value.

Some direves ves, such as ng-repeat, will copy a specific element (combination) for each element in the collection ). The compilation and link phases improve the performance. Because the cloned template only needs to be compiled once and then linked once for the elements in each set (similar to the template cache)

Iii. directive

Directive is an action that is triggered when a specific HTML structure is encountered during compilation. Directives can be placed in the name, attribute, class, or even comment of an element. Here are several methods to reference ng-bind (a built-in directive:

<span ng-bind="exp"></span><span class="ng-bind: exp;"></span><ng-bind></ng-bind><!-- directive: ng-bind exp -->

Directive is just a function that is executed by the compiler when it is encountered in the DOM ). The directive API documentation describes how to create a direve ve.

The following is an example that allows an element to play with your mouse ......

<! DOCTYPE html> 

Angular compiler (compiler) uses directives to process the DOM, rather than the string template. The processing result is a link function that combines with the scope model and generates a Real-Time template ). Binding a view to a scope model is transparent to us. Developers do not have to perform any action to update views or models. Furthermore, because innerHTML is not used to update the view template, user input is not interrupted. In addition, angular directives can not only bind text values, but also have a structure of behavior.





How to specify a compiler for CMAKE_C_COMPILER?

Set (CMAKE_C_COMPILER "/usr/bin/gcc-4.7 ")
 
Fatal error C1073: Internal error involving incremental compilation (compiler file "f: \ dd \ vctools \ compiler \ cxxfe \ sl \ p1 \ c \ mainc"

Program.

VC may have problems.

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.