The beast's angular Api learning, translating and understanding-Nghref, NGSRC, Ngcopy/ngcut/ngpaste

Source: Internet
Author: User

The beast's Ng API learns--Nghref, NGSRC, Ngcopy/ngcut/ngpaste

Nghref

When the angular program does not complete the HREF value that is bound with the {{hash}} method on the link, the user clicks on the link and jumps to the wrong page.

Format: ng-href= "value"

Value: An expression.

Using code:

<a ng-href= "http://www.xxxxx.com" > Click to go to xxxxx website </a>

If the URL of the href binding is a dynamic binding (from the code to the view), the HREF binding error occurs because angular has not compiled the expression on the HTML, and the value originally bound with the href is href= "{{ Hash}} ", and if you use ng-href, then angular will bind the URL after compiling, of course, when you see a tag attribute at the same time there are ng-href and href, the following href is parsed out, and the URL values on the 2 attributes are correctly bound.

Ngsrc

In angular, the {{hash}} tag on the SRC tag is incorrect. The browser will use the URL that includes the {{hash}} text before angular replaces the expression in {{hash}}. The ngsrc solved the problem.

How to use the error:

The right way to use:

Ngsrc and Nghref.

Ngcopy/ngcut/ngpaste

<input ng-copy= "Copy=true" ng-init= "COPY=FALSE; Value= ' Copy me ' "ng-model=" Value ">{{copy}}

<input ng-cut= "Cut=true" ng-init= "CUT=FALSE; Value= ' Cut Me ' "ng-model=" Value ">{{cut}}

<input ng-paste= "Paste=true" ng-init= "paste=false" placeholder= ' Paste here ' >{{paste}}

We can execute our custom events with the above three instructions, respectively, when triggering copy/Cut/paste.

The beast's angular Api learning, translating and understanding-Nghref, NGSRC, Ngcopy/ngcut/ngpaste

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.