Angularjs ng-bind-html instructions and instance code _ANGULARJS

Source: Internet
Author: User

Angularjs ng-bind-html Instruction

Angularjs instance

Binding <p> InnerHTML to variable myText:

<! DOCTYPE html>
 
 

Run Result:

My name is:

John Doe

Note: This instance contains the "Angular-sanitize.js" file, which removes the dangerous code in HTML.

Definitions and usage

The ng-bind-html directive is a secure way to bind content to HTML elements.
When you want Angularjs to write HTML in your application, you need to detect some dangerous code. By introducing the "angular-santize.js" module in the application, the Ngsanitize function is used to detect the security of the code. In your application, you can does so by running the HTML code through the Ngsanitize function.

Grammar

<element ng-bind-html= "expression" ></element>

All HTML elements support this directive.

Parameter values

value Description
Expression Specifies the variable or expression to execute.

Above is the ANGULARJS ng-bind-html instruction example Detailed introduction, has the need friend to be possible under the reference.

Related Article

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.