我在我的应用程序中使用Angular2 Material Design数据表,它很棒.我想知道是否有办法获得索引号或行号?有点像row.index?我在CDK数据表文档中注意到它提到"该指令还导出与ngFor相同的属性(索引,偶数,奇数,第一个,最后一个)",但没有任何示例如何获取索引.
非常感谢任何帮助或指导.谢谢!
我需要添加路由到MdDialog组件,我不知道解决这个问题的最佳方法是什么.
目前,在foo page(www.app.com/foo/1)上,用户可以单击一个按钮,它将打开一个MdDialog组件,bar.
我想要做的是,打开MdDialog后,它会附加/bar/:id到组件上.所以,例如它会是这样的www.app.com/foo/1/bar/1.目标是让用户拥有可以导致foo的可共享链接,然后打开MdDialog.
到目前为止,这就是我的应用程序的结构.
app/
app.component.html <- <router-outlet> is found here
app.component.ts
app.module.ts
foo/
foo-routing.module.ts
foo.component.html
foo.component.ts
foo.module.ts
bar/
bar.component.html <- This bar component file for the MdDialog
bar.component.ts
baz/ <- Another section of the website with it's own routing
baz-routing.module.ts
baz.component.html
baz.component.ts
baz.module.ts
...
Run Code Online (Sandbox Code Playgroud)
目前在我foo-routing.module.ts,我有这个:
const routes: Routes = [
{
path: 'foo/:fooId',
component: FooComponent,
children: [
{
path: 'bar/:barId',
component: BarDialogComponent
}
]
}
];
Run Code Online (Sandbox Code Playgroud)
但是,这不起作用.所有这一切都是打开模块,重新路由到/,并且不允许我点击其他链接.
有人有什么建议或想法吗?谢谢!