I know that one can export configure function and also register components as global resource. But what pattern do you use when your component provides "default" configuration that can be overridden? This needs to happen during configuration phase and needs to apply to all instances of the component. Do you use class with static members (typescript) or something else? Or, can I create instance of the config, set properties and add it to DI container somehow, so that all dependent components now get that instance?
import {PagingConfig} from "./PagingConfig";
export class PaginationConfig extends PagingConfig {
boundaryLinks = false;
boundaryLinkNumbers = false;
directionLinks = true;
rotate = true;
forceEllipses = false;
maxSize: number = null;
}
and here is my main.ts that configures. How do I override default configuration from above?
import * as Promise from "bluebird";
import {Aurelia} from "aurelia-framework";
import {PaginationConfig} from "./components/shared/PaginationConfig";
export function configure(aurelia: Aurelia):void {
aurelia.use
.standardConfiguration()
.developmentLogging()
.globalResources(["components/bar/InsightBarCustomElement",
"components/pagination/PaginationCustomAttribute"]);