Fundamentals - App Config & Startup - IV
Making Resources Global:
- View in Aurelia is completely encapsulated.so one must import/require components into an Aurelia view.
- Certain components are used so frequently across views that it can become tedious to import them over & over again. To solve this problem, Aurelia lets you explicitly declare certain "view resources" as global.
- The Configuration helper method defaultResources() takes the default set of view resources such as repeat, if, compose etc & makes them globally usable in every view.
- One can do the same with his/her own components. e.g.
Make a Component Global in ES Next
export function configure(aurelia){
aurelia.use.standardConfiguration( )
.developmentLogging( )
.globalResources('resources/my-component');
aurelia.start( ).then(( ) => aurelia.setRoot( ));
}
Comments
Post a Comment