File
Metadata
| changeDetection |
ChangeDetectionStrategy.OnPush |
| host |
{ } |
| providers |
{
provide: ListService, useExisting: UnitChildrenService,
}
|
| selector |
cx-org-unit-children |
| templateUrl |
./unit-children.component.html |
|
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 { Observable, of } from 'rxjs';
import { ListService } from '../../../shared/list/list.service';
import { CurrentUnitService } from '../../services/current-unit.service';
import { UnitChildrenService } from './unit-children.service';
@Component({
selector: 'cx-org-unit-children',
templateUrl: './unit-children.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
host: { class: 'content-wrapper' },
providers: [
{
provide: ListService,
useExisting: UnitChildrenService,
},
],
})
export class UnitChildrenComponent {
unit$: Observable<B2BUnit> = this.currentUnitService
? this.currentUnitService.item$
: of({ active: true });
constructor(protected currentUnitService: CurrentUnitService) {}
}
<cx-org-sub-list [showHint]="true">
<a
actions
class="link"
routerLink="create"
[class.disabled]="!(unit$ | async)?.active"
>
{{ 'organization.create' | cxTranslate }}
</a>
<cx-org-disable-info
info
i18nRoot="orgUnitChildren"
[displayInfoConfig]="{
disabledCreate: true,
disabledEnable: false,
disabledEdit: false
}"
>
</cx-org-disable-info>
</cx-org-sub-list>
Legend
Html element with directive