File

projects/storefrontlib/cms-components/navigation/navigation/navigation.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
selector cx-navigation
templateUrl ./navigation.component.html

Index

Properties

Constructor

constructor(componentData: CmsComponentData<CmsNavigationComponent>, service: NavigationService)
Parameters :
Name Type Optional
componentData CmsComponentData<CmsNavigationComponent> No
service NavigationService No

Properties

node$
Type : Observable<NavigationNode>
Default value : this.service.createNavigation( this.componentData.data$ )
styleClass$
Type : Observable<string>
Default value : this.componentData.data$.pipe( map((d) => d?.styleClass) )
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { CmsNavigationComponent } from '@spartacus/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { CmsComponentData } from '../../../cms-structure/page/model/cms-component-data';
import { NavigationNode } from './navigation-node.model';
import { NavigationService } from './navigation.service';

@Component({
  selector: 'cx-navigation',
  templateUrl: './navigation.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NavigationComponent {
  node$: Observable<NavigationNode> = this.service.createNavigation(
    this.componentData.data$
  );

  styleClass$: Observable<string> = this.componentData.data$.pipe(
    map((d) => d?.styleClass)
  );

  constructor(
    protected componentData: CmsComponentData<CmsNavigationComponent>,
    protected service: NavigationService
  ) {}
}
<cx-navigation-ui [node]="node$ | async" [ngClass]="styleClass$ | async">
</cx-navigation-ui>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""