feature-libs/organization/administration/components/user-group/services/current-user-group.service.ts
Properties |
Methods |
|
constructor(routingService: RoutingService, userGroupService: UserGroupService)
|
|||||||||
|
Parameters :
|
| getError | ||||||
getError(code: string)
|
||||||
|
Inherited from
CurrentItemService
|
||||||
|
Defined in
CurrentItemService:30
|
||||||
|
Parameters :
Returns :
Observable<boolean>
|
| Protected getItem | ||||||
getItem(code: string)
|
||||||
|
Inherited from
CurrentItemService
|
||||||
|
Defined in
CurrentItemService:26
|
||||||
|
Parameters :
Returns :
Observable<UserGroup>
|
| Protected getParamKey |
getParamKey()
|
|
Inherited from
CurrentItemService
|
|
Defined in
CurrentItemService:22
|
|
Returns :
any
|
| getRouterParam | ||||||
getRouterParam(paramKey: string)
|
||||||
|
Inherited from
CurrentItemService
|
||||||
|
Defined in
CurrentItemService:55
|
||||||
|
Parameters :
Returns :
Observable<string>
|
| Readonly b2bUnit$ |
Type : Observable<string>
|
Default value : this.routingService
.getParams()
.pipe(pluck(ROUTE_PARAMS.unitCode), distinctUntilChanged())
|
|
Inherited from
CurrentItemService
|
|
Defined in
CurrentItemService:40
|
|
Observes the b2bUnit based on the unitCode route parameter. |
| Readonly item$ |
Type : Observable<T>
|
Default value : this.key$.pipe(
switchMap((code: string) => (code ? this.getItem(code) : of(null)))
)
|
|
Inherited from
CurrentItemService
|
|
Defined in
CurrentItemService:33
|
|
Observes the active item. The active item is loaded by the active |
| Readonly key$ |
Type : Observable<string>
|
Default value : this.routingService
.getParams()
.pipe(pluck(this.getParamKey()), distinctUntilChanged())
|
|
Inherited from
CurrentItemService
|
|
Defined in
CurrentItemService:24
|
|
Observes the key for the active organization item. The active key is observed from the list of route parameters. The full route parameter list is evaluated, including child routes. To allow for specific ("semantic") route parameters, the route parameter key is
retrieved from the |
import { Injectable } from '@angular/core';
import { RoutingService } from '@spartacus/core';
import {
UserGroup,
UserGroupService,
} from '@spartacus/organization/administration/core';
import { ROUTE_PARAMS } from '@spartacus/organization/administration/root';
import { Observable } from 'rxjs';
import { CurrentItemService } from '../../shared/current-item.service';
@Injectable({
providedIn: 'root',
})
export class CurrentUserGroupService extends CurrentItemService<UserGroup> {
constructor(
protected routingService: RoutingService,
protected userGroupService: UserGroupService
) {
super(routingService);
}
protected getParamKey() {
return ROUTE_PARAMS.userGroupCode;
}
protected getItem(code: string): Observable<UserGroup> {
return this.userGroupService.get(code);
}
getError(code: string): Observable<boolean> {
return this.userGroupService.getErrorState(code);
}
}