Friday, May 19, 2017

Have a module for a nested component in Angular 2.

To get this to work, you have to have the module export the component. (the component is one of the module's "exports") Then the module for the component that has a template that calls out to the other, nested component by way of a selector tag must import the module exporting the wrapped component. (the small scope module is one of the "imports" at that outer module) This paradigm allows for some pipes to be looped in only when they are needed for nested components in lieu of them being app wide at a token, one-and-only module wrapping everything. This in turn saves some load time upfront.

No comments:

Post a Comment