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

如题,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),
        },
    },
    ],
    },
    ];

modal组件代码片段:

@Input()
record: any = {};
i: any;

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

ngOnInit(): void {
console.log(this.record);****//this.record = null, record怎么接收主组件中的record参数?****
if (this.record.id > 0)
this.http.get(/user/${this.record.id}).subscribe(res => (this.i = res));
}

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

阅读 3.4k
1 个回答

paramName 这个参数没有写。。。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进