我是新的角度2开发。我添加了一个组件,在这个组件中,我有一些其他的子组件。在以下方面,我的文件夹结构:子页面中的角度2路由问题
parentComponent
-child1Component
-child2Component
-child3Component
在parentComponent.html
我加入<router-outlet></router-outlet>
我从child1到孩子2导航,和儿童2 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
请你提供一个工作的例子吗? –