Reputation: 24958
Not sure how to tell my point where, hopei make it as clear as possible.
I tried running some apps that are using Polymer and/or AngularDart, including:
the apps works very fine, one I run them using, "Pub serve" (Aka Ctrl+R from Dart editor), but once I run from the Dartium using the file "URL" things are not working well!!
I got an answer in Dartisans' google+ community the web server is a mus (https://plus.google.com/u/0/110229866977286723923/posts/UAH8ez51S53), is this means neither Polymer nor AngularDarrt are pure client side! by pure client side I mean can run from the file URL, without a web server.
I was thinking to make small app, for learning and testing, and packing it into 2 forms: 1. as Android APK using Android web view, but as server is required 2. as Chrome app
but having both need a web server, and the JavaScript conversion (build) is not acting similar to the output using the file URL, i.e. not completely as required, I got stuck!
Note: I'm using Windows 7, 64x, latest edition of Dart (Dev. 1.6.0), and latest edition of both AngularDart and PolymerDart.
any thought or idea pls
Upvotes: 1
Views: 522
Reputation: 657416
This is the same issue as discussed here https://stackoverflow.com/a/25248166/217408
and here I tried to reproduce and wasn't able.
After running pub build
you can open the build output using a file URL just fine.
Polymer and Angular are definitely pure client side (if you want to use them this way).
That you can't run the Dart code without running pub build
first is a bug in DI (used by Angular.dart and bwu_polymer_routing. DI currently requires some code generation that is done only when pub build
or pub serve
is run.
See also
- https://github.com/angular/angular.dart/issues/1344
- https://github.com/angular/angular.dart/issues/1276
You can try to use the workaround mentioned in issue 1276
Module.DEFAULT_REFLECTOR = new DynamicTypeFactories();
Upvotes: 0
Reputation: 2274
You need a server to serve static content because there are a lot of features with those libraries that are pulling your resources in dynamically. This isn't a Dart or Polymer issue, this is a browser security feature. By default, you can't make AJAX calls to your local machine. Pub serve is handling this for you, but you can chose any server you want to serve your local assets.
Contrary to some of what the other answers are saying, you don't need to build your Dart code when you're in Dartium. Dartium has the Dart VM built in for that very reason.
Upvotes: 2
Reputation: 1546
You don't need a server, but you do need to build your code. pub serve
does this automatically (and keeps on doing it as you change your code, so it's perfect for development), but to be able to use a file://
url, you need to run pub build
first, and use the files generated in the build
directory.
Upvotes: 0
Reputation: 11
AFAIK you only need a server, but you need to generate some code, your development code can't directly go to your server, you need to do something like pub build, to make the code ready to be served directly.
Upvotes: 0