0
我目前正在使用Angular 4开展一个项目。直到今天,我没有使用路由器的问题,但我使用了Angular Materials组件,今天早上我看到我必须更新Angular Material软件包。我执行:Angular 4路由器加载所有组件
npm update
从那时起,当我使用RouterLink,组件加载实际页面顶部。例如,如果我在'/ dashboard'中,并且想要转到'/ signin'页面。 “登录”组件加载在仪表板的顶部,因此在同一页面中,我有仪表板组件和登录组件。
你有想法帮我解决这个问题吗?
编辑:
我的部件没有更多的responsives,如果我用一个* ngFor在我的组件定义了一个数组,如果数组改变与* ngFor不改变组件...我认为,我所有的问题都有联系,但我看不出如何。
我如何使用RouterLink:
<a md-tab-link routerLink="/login" routerLinkActive="active">Login</a>
我app.routing.module.ts的代码:
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { SentierDetailComponent } from './map/sentier/sentier-detail.component'
import { DashboardComponent } from './dashboard/dashboard.component';
import { LoginComponent } from './login/login.component';
import { SignInComponent } from './signin/signin.component';
import { MembreComponent } from './membre/membre.component'
import { FormComponent } from './form.component'
const routes: Routes = [
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent },
{ path: 'login', component: LoginComponent},
{ path: 'signin', component: SignInComponent},
{ path: 'sentier-detail/:id', component: SentierDetailComponent},
{ path: 'membres', component: MembreComponent},
{ path:'evenement', component: FormComponent}
];
@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
export class AppRoutingModule {}
请提供有关如何使用'RouterLink'的更多信息(代码示例) –
请提供如何配置RouterModule –