22

I am trying to use the Google developer AngularJS library in an extension popup, but I get an error.

Error: Code generation from strings disallowed for this context at Function (unknown source) at Jb (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:74:18) at k (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:62:357) at Jc (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:64:37) at Lc (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:69:166) at chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:74:241 at chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:51:270 at F (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:47:339) at X (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:39:390) at t (chrome-extension://jambnlbfljcfpomlclcgphfmkjfiphkb/lib/angular.js:38:286)

What is the proper way to write the following content_security_policy directive for a Google Chrome plugin manifest file?:

"content_security_policy": "default-src 'self'; script-src 'unsafe-eval' 'unsafe-inline'; style-src 'unsafe-inline'",

currently it is throwing an error...

2 Answers 2

46

You have to use CSP mode in angular to be inside Chrome extension. See: https://github.com/angular/angular.js/issues/893

Basically you have to declare your app as:

<html ng-app="" ng-csp>
Sign up to request clarification or add additional context in comments.

Comments

11

<html ng-app="" ng-csp> causes an error in Chrome stable M21 in a chrome-extension://*.xhtml file.

<html ng-app="" ng-csp=""> appears to work.

1 Comment

That's because the document in question is XHTML. XHTML is XML, and XML doesn't allow attributes without values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.