Angular API Core components of the instruction chapter

Source: Internet
Author: User

1 Ngapp

This instruction can automatically trigger the angular program, the Ngapp directive specifies the root node of the angular application, which is typically tied to the root node of the page, such as:<body> or

Only one Angularjs app per page can be automatically triggered, and the first Ngapp instruction in the document automatically triggers the ANGULARJS application. If you want to trigger multiple ANGULARJS applications in an HTML document, you need to use Angular.bootstrap to trigger them manually. Angularjs apps cannot be nested with each other.

You can specify a angular module as the root module for the angular application, and when the application is triggered, the module is loaded into $injector and other modules that the application code needs to rely on are loaded.

<! DOCTYPE html>
2 A

Overrides the default behavior of the HTML a tag, and when the href is empty, the default behavior is blocked, so no jumps occur.

3 Nghref

Write the angular tag {{hash}} directly in the href attribute, and when the user clicks on the link before angular replaces the value of {{hash}}, it will be linked to the wrong address and will typically return a 404 error.

The wrong wording:

<a href= "Http://www.somelinks.com/{{hash}" ></a>

The correct wording

<a ng-href= "Http://www.somelinks.com/{{hash}" ></a>

4 NGSRC

Using the angular tag {{hash}} in the SRC attribute does not get the correct result, and the browser obtains the SRC resource by means of the literal {{hash}} before angular the value of {{hash}}. This can lead to errors. NGSRC solved the problem.

The wording of a bug:

The correct wording:

 

Angular API Core components of the instruction chapter

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.