相关疑难解决方法(0)

如何获得角度2的当前路线自定义数据?

我设置的路线如下

const appRoutes: Routes = [
  {
    path: 'login',
    component: LoginComponent,
    data: {
      title: 'Login TTX'
    }
  },
  {
    path: 'list',
    component: ListingComponent,
    data: {
      title: ' TTX Home Page',
      module:'list'
    }
  },
  {
    path: '',
    redirectTo: '/login',
    pathMatch: 'full'
  },
];
Run Code Online (Sandbox Code Playgroud)

现在,当我来'/list' 路线然后'listing.component.ts'我写下面的代码

export class ListingComponent {

  public constructor(private router:Router) {
      //here how i can get **data** of **list** routes

  }
}
Run Code Online (Sandbox Code Playgroud)

angular2-routing angular

25
推荐指数
5
解决办法
3万
查看次数

标签 统计

angular ×1

angular2-routing ×1