mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fix node-permission directive for delete (#2730)
This commit is contained in:
committed by
Eugenio Romano
parent
754e02625e
commit
78cd7ad84b
@@ -90,16 +90,23 @@ export class UploadDragAreaComponent implements NodePermissionSubject {
|
||||
|
||||
### Defining your components as an EXTENDIBLE_COMPONENT parent component
|
||||
|
||||
The directive will look up the component in the dependency injection tree, up to at most one step above the current DI level (@Host). Because of this, you have to provide your component with forward referencing as the EXTENDIBLE_COMPONENT.
|
||||
The directive will look up the component in the dependency injection tree, up to the @Host() component.
|
||||
|
||||
> "The host component is typically the component requesting the dependency. **But when this component is projected into a parent component, that parent component becomes the host.**"
|
||||
|
||||
- because of this, you have to provide your component with forward referencing as the EXTENDIBLE_COMPONENT.
|
||||
- because of the emphasized second sentence you have to provide your component as a viewProvider.
|
||||
|
||||
```js
|
||||
import { EXTENDIBLE_COMPONENT } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
...
|
||||
providers: [
|
||||
viewProviders: [
|
||||
{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent)}
|
||||
]
|
||||
})
|
||||
export class UploadDragAreaComponent implements NodePermissionSubject { ... }
|
||||
```
|
||||
|
||||
**Notice the usage of viewProviders (instead of providers)! This part is very important, especially if you want to use this directive on a transcluded component!**
|
||||
|
@@ -46,8 +46,8 @@ import 'rxjs/add/observable/throw';
|
||||
selector: 'adf-upload-button',
|
||||
templateUrl: './upload-button.component.html',
|
||||
styleUrls: ['./upload-button.component.scss'],
|
||||
providers: [
|
||||
{provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadButtonComponent)}
|
||||
viewProviders: [
|
||||
{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadButtonComponent) }
|
||||
],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
|
@@ -31,7 +31,7 @@ import { Component, EventEmitter, forwardRef, Input, Output, ViewEncapsulation }
|
||||
selector: 'adf-upload-drag-area',
|
||||
templateUrl: './upload-drag-area.component.html',
|
||||
styleUrls: ['./upload-drag-area.component.css'],
|
||||
providers: [
|
||||
viewProviders: [
|
||||
{ provide: EXTENDIBLE_COMPONENT, useExisting: forwardRef(() => UploadDragAreaComponent)}
|
||||
],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
|
Reference in New Issue
Block a user