The PageLayoutService implementation has a CMS dependency: CMSService.
Metadata information for the current page, maintained through CMS.GetCurrentPage.
Get the current page context from the RoutingService and extract the actual data from the central ngRx store:
RoutingService. GetPageContext implementation: read from the store.
For TypeScript arrow functions, both of the following are correct:
The first is that the TypeScript compiler automatically deduce the function without specifying a return type.
let fun5 = (data:number)=> data * data;
The second kind: complete writing. The number after the first arrow indicates that the return type is number.
let fun5:(data:number) =>number = (data:number)=> data * data;
Select accept an input parameters: RoutingSelector getNextPageContext, this parameter is a see be a function: for any input types, the output type is PageContext:
The type definition of getNextPageContext is exactly the same as the type definition of mapFn specified in the select interface:
(state: any) => PageContext
select<any, PageContext>(mapFn: (state: any) => PageContext): (source$: Observable<any>) => Observable<PageContext>
The type definition of select itself: returns a function that takes an Observable of type T as an input parameter and an Observable object of type K as an output.
Assuming the RoutingState is already available, write the mapper function first. And then we’ll go back and figure out how to get the RoutingState, the GetRouterState.
In the same way:
More of Jerry’s original articles can be found on “Wang Zixi “: