File
Metadata
| changeDetection |
ChangeDetectionStrategy.OnPush |
| host |
{ } |
| providers |
{
provide: ListService, useExisting: UnitUserListService,
}
|
| selector |
cx-org-unit-user-list |
| templateUrl |
./unit-user-list.component.html |
|
routerKey
|
Default value : ROUTE_PARAMS.userCode
|
|
|
|
unit$
|
Type : Observable<B2BUnit>
|
Default value : this.currentUnitService
? this.currentUnitService.item$
: of({ active: true })
|
|
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { B2BUnit } from '@spartacus/core';
import { ROUTE_PARAMS } from '@spartacus/organization/administration/root';
import { Observable, of } from 'rxjs';
import { ListService } from '../../../../shared/list/list.service';
import { CurrentUnitService } from '../../../services/current-unit.service';
import { UnitUserListService } from '../services/unit-user-list.service';
@Component({
selector: 'cx-org-unit-user-list',
templateUrl: './unit-user-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'content-wrapper' },
providers: [
{
provide: ListService,
useExisting: UnitUserListService,
},
],
})
export class UnitUserListComponent {
routerKey = ROUTE_PARAMS.userCode;
unit$: Observable<B2BUnit> = this.currentUnitService
? this.currentUnitService.item$
: of({ active: true });
constructor(protected currentUnitService: CurrentUnitService) {}
}
<cx-org-sub-list key="customerId" [routerKey]="routerKey" [showHint]="true">
<a
actions
class="link"
routerLink="create"
[class.disabled]="!(unit$ | async)?.active"
>
{{ 'organization.create' | cxTranslate }}
</a>
<cx-org-disable-info
info
i18nRoot="orgUnitUsers"
[displayInfoConfig]="{
disabledCreate: true,
disabledEnable: false,
disabledEdit: false
}"
>
</cx-org-disable-info>
</cx-org-sub-list>
Legend
Html element with directive