AngularJS expressions and example code, angularjs expressions

Source: Internet
Author: User

AngularJS expressions and example code, angularjs expressions

I have learned about the basic usage of AngularJS. Here I will learn about the expressions in PDF.

Expressions in AngularJS are not exactly the same as those in js.

First, its expression must be placed in {} before it can be used. Second, compared with the expression concept in javascript, it has the following differences:

1. different scopes

In javascript, the default function is window, but it is different in angularJs. It uses $ scope control.

2. undefined values are allowed.

In angularjs, if an undefined expression is used, no error will occur and a null value will be returned directly.

3. Filter

You can use the | pipeline command in an expression to add a filter, which is similar to the UNIX command line.

4 $ symbol

It is used to distinguish angular methods from user-defined methods.

The following is a small piece of code:

<!doctype html>

Trigger the reset method through reset to reset the content of the name variable;

The undefined test is referenced in the expression, but no error is reported. It is displayed as null by default. -- {test }}

Finally, use the filter to convert the name value in the expression to uppercase. -- {Name | uppercase }}

Running result:

 

 

The above is to sort out the AngularJS expression information, and continue to add relevant information in the future. Thank you for your support!

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.