nbDialog how to pass context data to constructor ?
- Lenguaje dominante
- TypeScript
- Estrellas
- 8.1k
- Forks
- 1.5k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### Issue type
**I'm submitting a ...** (check one with "x")
* [x ] bug report
* [ ] feature request
### Issue description
We are doing a POC using Nebular / ngx-admin theme and have hit a roadblock relative to use of nbDialog.
We would like to pass Context Data to Constructor as compared to @INPUT
**Current behavior:**
I currently am able to pass data from the parent to the Dialog using @Input()
Parent component
```
` DeviceEdit(data: any, id: any, deviceid:any): void {
this.dialogService
.open(DeviceListDialogComponent, {
hasBackdrop: true,
closeOnBackdropClick: false,
hasScroll: true,
context: {
indicatorFlag: true,
operString: "UPDATE / DELETE",
_deviceListFields: data,
}
})
.onClose.subscribe(result => {
console.log(JSON.stringify(result));
if (result === 1) {
// this.refreshDeviceTypeList(false);
}
// this.ref.close(result);
});
}`
```
Dialog component
`
```
@Input() _deviceListFields: any[];
constructor(
protected ref: NbDialogRef,
private dialogService: NbDialogService,
) {
this.initDeviceListModel();
this.deviceListModel = _deviceListFields;
}`
```
**Expected behavior:**
The issue is that I cannot access _deviceListFields in the constructor.
If I add
`@Inject(NB_DOCUMENT) public _deviceListFields //protected document, //
`
and remove the @Input
and use Chrome Dev Tools to look at the contents of _devicelist, it contains the "document" as compared to the "data" that needs to be passed to Dialog .
Will appreciate a pointer on how to get this resolved.
### Other information:
**npm, node, OS, Browser**
```
```
**Angular 8.x, Nebular 4.6.0**
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.