头图

The templateName$ get operation in SAP Spartacus PageLayoutService.ts: returns an Observable object, the package type is string.

The first operation filter of the pipe is to ensure that the template attribute of the page object must exist, and to avoid the situation that the second map operation returns the undefined value wrapped by the Observable.

In the PageLayoutComponent implementation, there is an attribute with the same name.

Judging from the logic returned by layoutName$, take priority from section$. If there is a value in section$, return the value of section, otherwise directly return templateName$ of PageLayoutService.

You can view the specific implementation location of this project:

Get the template attribute from the page structure: the value is ProductDetailsPageTemplate

The specific principle is to get the relevant data of the product detail page from the ngrx central store:

After getting the result, call next to notify the corresponding subscriber:

More original articles by Jerry, all in: "Wang Zixi":


注销
1k 声望1.6k 粉丝

invalid