mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-8198 add injection to component data
This commit is contained in:
committed by
Darya Blavanovich
parent
d8634c901a
commit
f1fab8700a
@@ -79,6 +79,30 @@ function openDialog() {
|
||||
}
|
||||
```
|
||||
|
||||
To use dialog with provided component as a content `componentData` should be passed as data parameter. Inside component `DIALOG_COMPONENT_DATA` should be injected.
|
||||
|
||||
```ts
|
||||
//...
|
||||
|
||||
function openDialog() {
|
||||
const data: DialogData = {
|
||||
title: 'Dialog title',
|
||||
contentComponent: ExampleDialogComponent,
|
||||
componentData: { nodeId: 'nodeId', name: 'node name' } // any data can be passed
|
||||
};
|
||||
|
||||
this.dialog.open(DialogComponent, { data });
|
||||
}
|
||||
```
|
||||
|
||||
in `ExampleDialogComponent`:
|
||||
```ts
|
||||
export class ManageHoldsDialogComponent {
|
||||
inputs = inject(DIALOG_COMPONENT_DATA); // inputs = { nodeId: 'nodeId', name: 'node name' }
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Note that **fixed width** may be provided which will work correctly on smaller screens. But don't specify any values for **height**, as this may break the scrollable content and hide the buttons.
|
||||
To display the design well, it is necessary to provide no more than 2 additional buttons.
|
||||
|
||||
|
@@ -26,6 +26,7 @@ interface DialogData {
|
||||
descriptionTemplate?: TemplateRef<any>;
|
||||
headerIcon?: string;
|
||||
additionalActionButtons?: AdditionalDialogActionButton[];
|
||||
componentData: any;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -48,6 +49,7 @@ interface DialogData {
|
||||
| actionsTemplate | `TemplateRef<any>` | | Inserts a template styled on the left. Should be used for additional `mat-button` style buttons. (optional) |
|
||||
| descriptionTemplate | `TemplateRef<any>` | | Inserts a description template. (optional) |
|
||||
| additionalActionButtons | `AdditionalDialogActionButton[]` | | Inserts additional base-styled buttons into the action bar on the left. (optional) |
|
||||
| componentData | `any` | | Data that injected in contentComponent. (optional) |
|
||||
|
||||
## See also
|
||||
|
||||
|
Reference in New Issue
Block a user