2016-07-04 8 views
0

私のAngular Dartサイトはpub serveでうまく動作します。私はApacheでそれを実行することを好むでしょう。私は/ index.htmlのURLのjazzcat.locを入力すると、私は以下のブラウザのエラーを取得:サイトのApacheでAngularDartを実行中

GET http://jazzcat.loc/packages/browser/dart.js index.html:22 
GET http://jazzcat.loc/packages/polymer/polymer.dart package:polymer/polymer.dart:1 
An error occurred loading file: package:polymer/polymer.dart index.html:22 
GET http://jazzcat.loc/packages/angular2/platform/browser.dart package:angular2/platform/browser.dart:1 
An error occurred loading file: package:angular2/platform/browser.dart 
index.html:22 GET http://jazzcat.loc/packages/jazzcat/app_component.dart package:jazzcat/app_component.dart:1 
An error occurred loading file: package:jazzcat/app_component.dart favicon.ico:1 
GET http://jazzcat.loc/favicon.ico 404 (Not Found) 

仮想ホストエントリは次のとおりです。

<VirtualHost *:80> 
    ServerName jazzcat.loc 
    DocumentRoot /Volumes/Data/htdocs/jazzcat/web 

    <directory /Volumes/Data/htdocs/jazzcat/web> 
    Allow from all 
    Options -MultiViews 
    Require all granted 
    </directory> 
</VirtualHost> 

何の.htaccessファイル

はありません

これはindex.htmlにある:

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Jazz Cat</title> 
    <script> 
     window.Polymer = window.Polymer || {}; 
     window.Polymer.dom = 'shadow'; 
    </script> 

    <!-- For testing using pub serve directly use: --> 
    <base href="/"> 
    <!-- For testing in WebStorm use: --> 
    <!-- base href="/dart/web/" --> 

    <link href="master.css" rel="stylesheet" type="text/css" /> 
    <script defer src="main.dart" type="application/dart"></script> 
    <script defer src="packages/browser/dart.js"></script> 
    </head> 
     <my-app>Loading...</my-app> 
</html> 

私も

を使用してみました
<base href="/dart/web/"> 

エラーです。私はChromiumブラウザでテストしています。

ルーティングに関する質問と回答があります。それらはindex.html以外のルーティングにも適用されるようです。私の知る限りpub serve

答えて

1

はアプリを提供するためにApacheを使用する場合、あなたは、here you might find more information定期 HTML + JavaScriptのアプリにアプリを変換するためにpub buildを使用(および最適化)する必要があるかもしれませんが、開発時に使用されることを意味しています。

+0

...「HashLocationStrategy」に切り替えるか、サーバーがHTML5プッシュステートをサポートしていることを確認してください(http://krasimirtsonev.com/blog/article/apache-htaccess-for-html5-push-state-manipulations)。 http://stackoverflow.com/questions/36861628/location-and-hashlocationstrategy-stopped-working-in-beta-16 –

+0

これについて考えてみたら、意味があります。 – curt

+0

@GünterZöchbauer、HashLocationStrategyはpubサービスと連携しますか?私はまた、ページをリロードすることはできませんし、問題に関するいくつかの質問と答えを読んだが、彼らは修正プログラムを実装している環境の下で言及しません。私はパブで働くことを意図していないものを試す時間を無駄にしたくありません。 – curt

関連する問題