路由器导航不会重定向到其他页面

时间:2018-06-07 12:05:06

标签: angular typescript angular-routing

当他点击数据表行时,我会将用户重定向到另一个页面

HTML

<p-table  [value]="users" selectionMode="single"  [(selection)]="selectedUser" dataKey="uid" (onRowSelect)="selectedUserDetails($event)" styleClass="tab-result">
TS文件中的

selectedUserDetails(userDetails) {
   console.log(userDetails);
   console.log("enterhere"); // is printed on console dev
   this.router.navigate['/userdetails'];
}

模块路由

const routes: Routes = [
  {
    path: "",
    component: AdministrationComponent,
    children: [
      { path: "", component: ResulTabComponent, pathMatch: "full" },
      { path: "userdetails", component: UserDisplayComponent }
    ]
  }
];

对于信息管理路线,在此路径上http://localhost:4200/administration

延迟加载

userdetails应为http://localhost:4200/administration/userdetails

管理组件

<router-outlet></router-outlet>

我的问题是点击时我没有被重定向到userdetails页面,但当我从url栏导航到/ userdails时,我看到了组件

2 个答案:

答案 0 :(得分:8)

您尚未调用该函数,只是尝试访问 df1 %>% filter(!week %in% week_e) week sales 1 1 10 2 2 24 3 3 23 4 4 54 5 5 65 6 6 45 属性中名为/userdetails的属性。你错过了navigate

()

答案 1 :(得分:0)

添加括号&#34;()&#34;并删除斜杠&#34; /&#34;

function range(arr1, arr2){
var arr = [];
for( var i = arr1; i <= arr2; i++ ){
    arr.push(i);
}
return arr;
}

尝试如下路由:

exchanges