を行うとき、私は、このソースコードを見ていた私のために動作しません:https://github.com/angular/angular.io/blob/master/public/docs/_examples/toh-5/dart/lib/app_component.dartルーティングがハードリフレッシュ
と私はルートに行くとき、それは今の私のアプリケーションの意志ルートと思われます。
はlocalhost:8080/
ルーティングアップデートを私は自分のアプリケーションを移動、私が何かをしていた場合と思われるよう:localhost:8080/dashboard
basecaseで、ハードリフレッシュを行い、それが失敗しました。それは私に404 not found!
エラーを与えるでしょう。
もし私がすれば、それはちょうど見つけることができます:localhost:8080/#!/dashboard
それは私のアプリケーションに渡されたアドレスではありません。私が持っているのindex.htmlで
次のよう<base href="/">
マイApp_Component.dartファイルは次のとおりです。
import 'package:angular2/angular2.dart';
import 'package:angular2/router.dart';
import 'hero_component.dart';
import 'heroes_component.dart';
import 'dashboard_component.dart';
import 'hero_service.dart';
@Component(
selector: "my-app",
directives: const [ROUTER_DIRECTIVES],
providers: const [HeroService, ROUTER_PROVIDERS],
templateUrl: "app_component.html")
@RouteConfig(const [
const Route(
path: "/dashboard",
name: "Dashboard",
component: DashboardComponent,
useAsDefault: true),
const Route(
path: "/detail/:id", name: "HeroDetail", component: HeroDetailComponent),
const Route(path: "/heroes", name: "Heroes", component: HeroesComponent)
])
class AppComponent {
String title = "Tour of Heroes";
}
私がこれを除いてすべてのために働いてルーティングしているようです。
localhost:8080/detail/14としていますが、これで正しいコンポーネントが開かれます。これは、アプリケーション全体をナビゲートするときと同じくらい新しいサイト参照で今行われていないことです。
完璧!よく働く。私は研究しており、ここにそれが気付いています:https://github.com/ng2-dart-samples/router/blob/master/web/main.dart。私はこの答えが一番好きです。 – Fallenreaper
pub_serve_rewritesの代わりに、たとえばnginxをプロキシとしてプロキシとして使用することもできます。うん、カスパーはAngular2ダートのコミュニティでかなり活発だった。彼は現在、彼の数学の研究で忙しいと思われる: - / –