DanWahlin / Angular-JumpStart

Angular and TypeScript JumpStart example application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Application Code

aparnapatil01 opened this issue · comments

Hello Dan,

This question is regarding the pagination module. The pagination module is already imported in the SharedModule and SharedModule is loaded in app.module.ts. Since, the pagination functionality is used on the customers page, and we have already imported the SharedModule(which have PaginationModule) in the main app.module.ts file. Why is it again required to import this SharedModule in the CustomersModule? If I do not import in CustomersModule it throws error and as per my understanding if the module is imported in the main app.module.ts it is available to the whole application. Could you please help me to understand?

Another question, in the customers-card.component.html,
*ngFor="let customer of customers;trackBy:trackbyService.customer"

The customer is the function in the trackbyService, but the customer function is called without the use of paranthesis from template. In which scenario does this works?

--
Thanks

Imported module functionality such as components/pipes/directives is available only to the module where it's imported. Child modules don't automatically have access to the shared functionality. That's why SharedModule had to be imported into customers....it needs access to the components/pipes/directives in SharedModule just like AppModule needs access.

Hi Dan,

Thank you so much for clarification.

--
Thanks