2
Angular1では、アプリケーションはすべてのリソースを取得して初期化するために、初期ロード時に1〜3秒かかります。その後、別のルートに移動すると#urlに#tab1が追加され、すぐにそのルートに切り替わります。Angular2ルータの高速化方法
これはAngular2でも可能ですか?
angle.ioの各例では、アプリ全体を再読み込みするので、ローダーで空白の画面を見ながら1〜3秒かかります。 #pathは追加されません。私は別のルータを使用してその速度に戻るべきでしょうか?
index.htmlを
<html>
<head>
<base href="/">
は、ここに私のルータの設定です:
const appRoutes: Routes = [
{ path: 'classes', component: ClassesComponent },
{ path: 'classes/:id', component: ClassDetailComponent },
{ path: 'products', component: ProductsComponent },
{ path: 'products/:id', component: ProductDetailComponent },
{ path: '', redirectTo: 'products', pathMatch: 'full' },
{ path: 'cache/clear', component: CacheComponent },
{ path: '**', component: PageNotFoundComponent }
];
export const appRoutingProviders: any[] = [];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
これが起こっている場合は、セットアップにかなり間違っています。あなたは 'HashLocationStrategy'に切り替えることができますか? '
'要素(または 'APP_BASE_HREF'が提供されています)に'あなたは 'routerLink'とリンクしていますか? htmlの先頭に ' 'がありますか? –
joaumg
@GünterZöchbauer聞いてよかった! はindex.htmlの先頭にあります –