Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid JQuery globalEval call when using AngularJS in Chrome Packaged Apps?

I am building a Chrome Packaged App, where according to CSP I am not allowed to use eval() method. Now since I'm using JQuery (version 1.10.2) and AngularJS (version 1.0.6), one of the library method calls JQuery globalEval internally. (globalEval calls eval internally, which can not be used in this context)

Has anyone come across the same issue? Any workaround other than re-engineering JQuery/AngularJS library method?

like image 562
D.S Avatar asked Oct 03 '13 07:10

D.S


1 Answers

Both angular and jquery works with CSP without any problems. But angular needs extra configuration for this :ngCsp

In short, you will have to add ng-csp directive to the <html> tag. This will tell angular that CSP is enabled, and it will not try to do things forbidden by CSP.

like image 110
jusio Avatar answered Nov 17 '22 03:11

jusio