2016-11-28 5 views
0

https://github.com/InfomediaLtd/angular2-materializeでアプリケーションを構築していて、ページルーティングの後に問題が発生しています。 this.router.navigate(['xxxxx']。 これはモーダルでは機能しません。フルスクリーンイメージズーム、タブ、オートコンプリート(ただし、materialize.jsは機能しないと思われます)角2ルーティング後に問題を具体化する

追加の注意:私がルーティングしたページを更新すると、materialize.jsの機能は期待通りに機能します。

コードサンプルと更新

import {ActivatedRoute, Router} from "@angular/router"; 
... 
constructor(private router: Router) {} 
... 
// after this call is made, all materialize javascript features are lost on the resulting page 
this.router.navigate(['/add', add.id]); 

routes.ts

export const routes: Routes = [ 
    { 
    path: '', 
    component: MainComponent 
    }, 
    { 
    path: 'add/:id', 
    component: AddComponent, 
    children: [ 
     { path: '', redirectTo: 'first' }, 
     { path: 'first', component: FirstComponent }, 
     { path: 'second', component: SecondComponent }, 
    ] 
    } 
]; 
+0

でプロバイダにこれを追加し

import { HashLocationStrategy, LocationStrategy } from '@angular/common'; 

あなたapp.module.tsにbolowラインをインポートOW 404エラーコンセプトシングルページはここでは実現しません。 – Joshua

答えて

0

routerLinkにjqueryのを使用してページ全体をリロードすることによってハックを行うことに成功しても、私は、同じような状況に直面していますJSファイルを作成し、追加のコンポーネントで

<a [routerLink]="['link2']" class="linkReload"> 

をクリックしますケース角度SHで次のコード(jqueryの追加)

$('.linkReload').click(function() { 
    location.reload(); 
    }); 

NBリロード は、その後、我々は再びすべてのルータのページをロードするとapp.module.ts

{provide: LocationStrategy, useClass: HashLocationStrategy} 
関連する問題