私は新しいAngular 2開発です。1 つのコンポーネントを追加しました。このコンポーネント内には、他の子コンポーネントがあります。次の方法で私のフォルダ構造:
parentComponent
-child1Component
-child2Component
-child3Component
でparentComponent.html
追加しました<router-outlet></router-outlet>
child1 から child2、child2 から child3 へのナビゲーションがあります。また、その逆に戻ることもできます。戻って私が使用して this._location.back();
います。
戻るボタンを使用して後方に移動すると、現在のルートに前のページ コンポーネントが表示されます。
例えば :
戻るボタンを使用してchild2からchild1に移動すると。child1 ルートは、まだ child1 ページに子 html パーツを表示しています。
ルーティングには、次のように使用しています:
{ path: "parent", component: parentComponent,
children: [
{ path: "child1", component: child1Component },
{ path: "child2", component: child2Component },
{ path: "child3", component: child3Component}
],
data: { breadcrumb: 'Parent' }
}
なぜそれが起こっているのかわかりません.助けてください!!
バージョン情報
@angular/cli: 1.2.6
node: 6.10.0
os: win32 x64
@angular/animations: 4.3.2
@angular/common: 4.3.2
@angular/compiler: 4.3.2
@angular/core: 4.3.2
@angular/forms: 4.3.2
@angular/http: 4.3.2
@angular/platform-browser: 4.3.2
@angular/platform-browser-dynamic: 4.3.2
@angular/router: 4.3.2
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.2
@angular/language-service: 4.3.2