3

Does anyone know if Angular2 will be able to run from file:/// at all? If so, please point me to a sample template.

I have created a sample angular2 app using the angular-cli. I tested the sample and got the default "app is working!" message. After this, I used "ng build -prod" to create the distribution output. I also ran "ng serve -prod" to test the production build.

I get missing bundled files (file:///C:/main.d02450dd52811831e517.bundle.js), and I guess it is due to the that forces the file system to root in the working drive.

JDeVil
  • 463
  • 3
  • 18

3 Answers3

1

keep a base href . [A dot character]!!

We did the same thing & Were even able to run it as a cordova app.

Parth Ghiya
  • 6,929
  • 2
  • 30
  • 37
0

That doesn't work because of Chrome security constraints. You can pass command line parameters to Chrome to disable these constraints.

It might be Chrome allow file access from files no longer working (was using to see WebGL/three.js files)?

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • That link points me to simple web server solution. I do not have that as an option. I need to launch an HTML page in a WebKit control using file:///<>/index.html. Angular 1 works if we store all the HTML partials in templates.js to bypass the XDR limitation. – JDeVil Nov 18 '16 at 14:48
  • I don't know about that setup but perhaps you can provide some HTTP server embedded in your application that you can point the webkit control to. Then the code outside the control loads the files from disk that were requested from webkit and just forwards it. – Günter Zöchbauer Nov 18 '16 at 14:51
  • Unfortunately, iOS prevents hosting a web server. And my solution has to be consistent across all implementations. The current implementation has a file:/// protocol design. vNext will host in a local web server. But for now, I need the file protocol. Was hoping to use Angular2 and upgrade from Angular1 – JDeVil Nov 18 '16 at 15:11
  • How did you test to get the message "app is working"? – AMagyar Nov 18 '16 at 16:05
  • I ran "np serve -prod" serving up the sample with local web server (node) – JDeVil Nov 18 '16 at 18:52
  • Is there a way to bump this thread so that it can be seen by more or come to the attention of the google developers? – JDeVil Nov 24 '16 at 11:05
0

With help from others we resolved the issue: Github Issue

JDeVil
  • 463
  • 3
  • 18