
Description
I'm submitting a ... (check one with "x")
[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
We are working on a brand new project with restrict CSP(Content Security Policy) requirement. Here's our CSP requirement: X-Content-Security-Policy:default-src 'self'; style-src 'self' 'unsafe-inline'
This has been set through headers.
For our production setting, we've bundled all source files and templates (with system builder) during build process. While the app loading in CSP strict mode, we see the same issue as this one: https://stackoverflow.com/questions/38734708/make-angular2-works-with-restrictive-content-security-policy-csp
Searched all possible solutions, offline template compiler seems to be a way to solve the issue. However, we could not find a valid offline template compiler yet.
Things we've tried so far - (with the Angular 2 production release)
https://github.com/smmorneau/tour-of-heroes -- tested the build process, the output doesn't work in restrict CSP mode.
Angular cli tool: Does not support offline template compiler yet?
https://www.npmjs.com/package/angular2-template-compiler : This seems to be outdated. Got this: "Error: Cannot find module '@angular/compiler/src/html_parser' ..... at Object....."
compiler-cli (https://github.com/angular/angular/tree/master/modules/%40angular/compiler-cli): Could not get it to work. Is this one ready for production yet?
Also by search through the angular 2 core files, I see https://npmcdn.com/@angular/[email protected]/bundles/core.umd.js has 5 "new Function()" calls. This is outside template compiler. Even I can get the offline template compiler works, could this trigger the "unsafe-eval" from browser?
Expected behavior
Does the Angular 2 currently support restrictive Content Security Policy ? If yes, what should we do to make it work?
Reproduction of the problem
What is the motivation / use case for changing the behavior?
We really need to make our web app works in restrictive Content Security Policy mode, can be get a clear answer for this?
Please tell us about your environment:
We'are using the Angular 2 production release version.
-
Angular version: 2.0.X
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
-
Node (for AoT issues):
node --version
=