I have installed "@nebular/theme": "^7.0.0". And I'm trying to pass parameters via the NbDialogService to the component via the context property of the config, but I'm unable to read it into the dialog component. I've tried to declare @Input variables to look for 'data', 'context', or something like 'config' but it returns me undefined.
// this is the main component from which I want to call the modal and pass some parameters
constructor(private dialogService: NbDialogService) {}
ngOnInit(): void {}
openAddNewDialog() {
const dialogRef = this.dialogService.open(AddStudentComponent, {
context: 'Hello world',
});
dialogRef.onClose.subscribe((resp) => {
console.log(`dialog closed`);
console.log(resp);
});
}
These are the options I've tried to read the passed params into the dialog component
// add-student.component.ts
context: any;
data: any;
constructor(public ref: NbDialogRef<AddStudentComponent>) {
console.log(this.data);
console.log(this.context);
console.log(ref);
}
ngOnInit(): void {
console.log(this.data);
console.log(this.context);
}
// add-student.component.ts
@Input() context: any;
@Input() data: any;
constructor(public ref: NbDialogRef<AddStudentComponent>) {
console.log(this.data);
console.log(this.context);
console.log(ref);
}
ngOnInit(): void {
console.log(this.data);
console.log(this.context);
}