Search code examples
angularjsdartpolymerdart-polymerangular-dart

Is server required to run some CLIENT side DART apps using Polyemer.dart and/or Angular.Dart?


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:

  1. https://www.dartlang.org/docs/tutorials/forms/#about-the-slambook-example
  2. http://bwu-dart.github.io/users

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


Solution

  • 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.