首页 新闻 会员 周边

angular ng-alain delon类库,curd组件,modal传值

0
悬赏园豆:50 [已关闭问题] 关闭于 2018-12-05 11:41

如题,ng-alain模板中,使用delon类库创建一个curd组件,curd组件中,点击编辑按钮向编辑子组件传值失败,请问,这个参数应怎么穿过去?
主组件代码片段:
columns: STColumn[] = [
{ title: '编号', index: 'no' },
{ title: '调用次数', type: 'number', index: 'callNo' },
{ title: '头像', type: 'img', width: '50px', index: 'avatar' },
{ title: '时间', type: 'date', index: 'updatedAt' },
{
title: '',
buttons: [
{
text: '编辑',
type: 'modal',
modal: {
component: TestCurdEditComponent,
params: (record: any) => (record = record),
},
},
],
},
];
子组件代码片段:
@Input()
record: any = {};
i: any;

constructor(
private modal: NzModalRef,
private msgSrv: NzMessageService,
public http: _HttpClient,
) {}

ngOnInit(): void {
console.log(this.record);//this.record的值为空
if (this.record.id > 0)
this.http.get(/user/${this.record.id}).subscribe(res => (this.i = res));
}

学习angular的新手,请帮忙看看子组件怎么才可以获取到record的值,谢谢。

又沙又甜的主页 又沙又甜 | 初学一级 | 园豆:120
提问于:2018-12-02 21:18
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册