如何查看 SAP Spartacus PageLayoutComponent 裏的 template$ 的值

SAP Spartacus PageLayoutService.ts 裏的 templateName$ get 操做:返回一個 Observable 對象,包裹的類型爲 string.spa

pipe 的第一個操做 filter,目的是確保 page 對象的 template 屬性必定存在,避免接下來第二個 map 操做出現返回被 Observable 包裹的 undefined 值的狀況。對象

而在 PageLayoutComponent 實現裏,有一個同名屬性。ip

從 layoutName$ 返回的邏輯看,優先從 section$ 裏取數。若是 section$ 裏有值,返回 section 的值,不然直接返回 PageLayoutService 的 templateName$.rem

能夠查看到這個 project 的具體實現位置:
get

從 page 結構裏拿到 template 屬性:值爲 ProductDetailsPageTemplate
string

具體原理,是從 ngrx central store 裏,拿到 product 明細頁面相關數據:it

拿到 result 後,調用 next,通知對應的 subscriber:pip

更多Jerry的原創文章,盡在:"汪子熙":
io