I want to pass object to NbDialogComponent and how to get object from NbDialogComponent.
Anyone say, Is way correct?
I try this way for pass object, Component file:
import { NbDialogService } from "@nebular/theme";
constructor(private dialogService: NbDialogService) { }
const paymentData : any = {
service_id: 1,
information: [{info:'test1'},{info:'test2'}],
amount: 1000,
};
this.dialogService.open(AgreementComponent, {
context: {data: paymentData}, // here i have got typescript error
hasBackdrop: true,
closeOnBackdropClick: false,
});
Typescript Error: How to i fix this error
Type '{ data: any; }' is not assignable to type 'string | Partial'. Object literal may only specify known properties, and 'data' does not exist in type 'Partial'.ts(2322) dialog-config.d.ts(47, 5): The expected type comes from property 'context' which is declared here on type 'Partial<NbDialogConfig<string | Partial>>'
I try to this way for get obejct, DialogComponent File:
import { NbDialogRef } from '@nebular/theme';
constructor(protected dialogRef: NbDialogRef<AgreementComponent>) {}
ngOnInit(): void {
console.log('dialogRef', this.dialogRef.componentRef.instance.data);
}
Anyone tell me how to pass and receive object correct way and how to fix typescript error.