The lates AngularJS (1.3 beta 19) uses eval
. This is prohibited in chrome extionsion.
How to fix the issue without allowing evals?
Error message:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' chrome-extension-resource:".
Stack trace:
angular.js:1011
csp angular.js:1011
(anonymous function) angular.js:23556
UPDATE: See documentation of ng-csp
https://docs.angularjs.org/api/ng/directive/ngCsp
OUTDATED: It looks like AngularJS fails to detect CSP in chrome extension. Use explicit ng-csp
. Link to the AngularJS issue: https://github.com/angular/angular.js/issues/8777
Solution found: enforcing CSP mode by adding
ng-csp
on an element of document.See documentation of
ng-csp
https://docs.angularjs.org/api/ng/directive/ngCspTo quote documentation that Dmitry linked: