Latest web development tutorials

AngularJS ng-csp instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

AngularJS modify the behavior and inline styles on "eval" is:

<Body ng-app = "" ng-csp>
...

try it"

Definition and Usage

ng-csp instructions for modifying AngularJS security policy.

If theng-csp instruction, AngularJS will not be executed eval function, so you can not inject inline styles.

Ng-csp instruction set for the no-unsafe-eval,eval function will prevent AngularJS execution, but allows injection inline styles.

Ng-csp instruction set for the no-inline-style,will prevent AngularJS injected inline styles, but allow execution eval function.

If Google Chrome extension developers or Windows applicationsng-csp instruction is necessary.

Note: ng-csp directive does not affect the JavaScript, but will modify AngularJS way of working, which means: You can still write eval function, and can also perform normal, but can not perform its own AngularJS eval function. If compatibility mode will be reduced by 30% performance.


grammar

<Element ng-csp = "no -unsafe-eval | no-inline-style"> </ element>

Parameter Value

value description
no-unsafe-eval
no-inline-style
Value can be set to null, meaning eval and inline styles are allowed.
You can set one value.
You can also set two values ​​separated by semicolons, but the effect is the same blank.

AngularJS Reference Manual AngularJS Reference Manual