简体   繁体   English

服务器是否需要使用Polyemer.dart和/或Angular.Dart运行某些CLIENT端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: 我尝试运行一些使用Polymer和/或AngularDart的应用程序,包括:

  1. https://www.dartlang.org/docs/tutorials/forms/#about-the-slambook-example https://www.dartlang.org/docs/tutorials/forms/#about-the-slambook-example
  2. http://bwu-dart.github.io/users 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!! 这些应用程序运行良好,我使用“ Pub服务”(Dart编辑器中的Aka Ctrl + R)运行它们,但是一旦我使用“ URL”文件从Dartium运行,则运行不正常!

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! 我在Dartisans的google +社区中得到了一个答案,网络服务器是一个音乐( https://plus.google.com/u/0/110229866977286723923/posts/UAH8ez51S53 ),这意味着Polymer和AngularDarrt都不是纯客户端! by pure client side I mean can run from the file URL, without a web server. 通过纯客户端,我的意思是可以从文件URL运行,而无需Web服务器。

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 我当时想制作一个小型应用程序,用于学习和测试,并将其打包为2种形式:1.作为使用Android Web视图的Android APK,但作为服务器是必需的2.作为Chrome应用程序

but having both need a web server, and the JavaScript conversion (build) is not acting similar to the output using the file URL, ie not completely as required, I got stuck! 但是两者都需要Web服务器,并且JavaScript转换(构建)的行为与使用文件URL的输出不同,即,不完全符合要求,我陷入了困境!

Note: I'm using Windows 7, 64x, latest edition of Dart (Dev. 1.6.0), and latest edition of both AngularDart and PolymerDart. 注意:我使用的是Windows 7、64x,Dart的最新版本(版本1.6.0)以及AngularDart和PolymerDart的最新版本。

any thought or idea pls 任何想法或想法

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. 这不是Dart或Polymer的问题,这是浏览器的安全功能。 By default, you can't make AJAX calls to your local machine. 默认情况下,您无法对本地计算机进行AJAX调用。 Pub serve is handling this for you, but you can chose any server you want to serve your local assets. Pub serve可以为您解决这个问题,但是您可以选择要为本地资产提供服务的任何服务器。

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中时不需要构建Dart代码。 Dartium has the Dart VM built in for that very reason. 因此,Dartium内置了Dart VM。

AFAIK您只需要一个服务器,但是您需要生成一些代码,您的开发代码不能直接进入您的服务器,您需要执行诸如pub build之类的事情,以使这些代码可以直接提供。

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. pub serve会自动执行此操作(并在更改代码时继续执行此操作,因此非常适合开发),但是要使用file:// url,需要首先运行pub build ,并使用生成的文件在build目录中。

This is the same issue as discussed here https://stackoverflow.com/a/25248166/217408 这与此处讨论的问题相同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. 运行pub build您可以使用文件URL打开构建输出。

Polymer and Angular are definitely pure client side (if you want to use them this way). Polymer和Angular绝对是纯客户端(如果您想以这种方式使用它们)。

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 您必须先运行pub build才能运行Dart代码是DI中的一个错误(由Angular.dart和bwu_polymer_routing使用。DI当前需要生成一些代码,这些代码仅在运行pub buildpub serve才能完成。另请参见- 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 您可以尝试使用在问题1276中提到的解决方法

Module.DEFAULT_REFLECTOR = new DynamicTypeFactories();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM