전체 페이지뷰

2016년 2월 4일 목요일

angular js ngBindHtml ie error

I used the ng-bind-html in angular js but I didn't read carefully 


Evaluates the expression and inserts the resulting HTML into the element in a secure way.

I just declared the element with ng-bind-html element with duplicate
<ANY
  ng-bind-html="expression">
 {{ expression }} </ANY>
chrome is good but Internet Explorer didn't good
IE Browser displayed the console error  invalid arguments


ngBindHtml

  1. - directive in module ng
Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default, the resulting HTML content will be sanitized using the $sanitize service. To utilize this functionality, ensure that$sanitize is available, for example, by including ngSanitize in your module's dependencies (not in core Angular). In order to use ngSanitize in your module's dependencies, you need to include "angular-sanitize.js" in your application.

You may also bypass sanitization for values you know are safe. To do so, bind to an explicitly trusted value via $sce.trustAsHtml. See the example under Strict Contextual Escaping (SCE).

Note: If a $sanitize service is unavailable and the bound value isn't explicitly trusted, you will have an exception (instead of an exploit.)

Directive Info

  • This directive executes at priority level 0.

Usage

  • as attribute:
    <ANY
      ng-bind-html="expression">
    ...
    </ANY>

Arguments

ParamTypeDetails
ngBindHtmlexpression
Expression to evaluate.

Example

  Edit in Plunker
<div ng-controller="ExampleController">
 <p ng-bind-html="myHTML"></p>
</div>

댓글 없음:

댓글 쓰기