Press the Load button to load the configuration.
Ch5 components can be preconfigured with default values for attributes and for templatevariables.
The configuration can be done using Ch5Config and its methods:
- loadConfig(config:TCh5Config) loads a new configuration and overrides the existing one.
- setAttributeForId(elementId:string, attributeName:string, attributeValue:string) sets an attributeValue
for an attributeName of the specified HTML elementId
- setAttributeForComponent(componentName:string, attributeName:string, attributeValue:string) sets an attributeValue
for an attributeName of the specified ch5 component (componentName)
- setTemplateVarsForId(elementId:string, tempVarsItems:any[]) sets the template
variables for the ch5 component having the specified elementId
- getConfig() returns the current configuration object
- getAttributesForId(elementId:string):TCh5ConfigAttributes returns the configrued attributes for the
component having the specified elementId
- getAttributesForComponent(componentName:string):TCh5ConfigAttributes returns all configured attributes
for the component specified in componentName ( for example 'ch5-button')
- getTemplateVarsForElementById(elementId:string):TCh5ConfigTemplateVars[] returns the configured template
variables for the component having the specified elementId
-
getAttributesForElement(cr:Ch5Common):TCh5ConfigAttributes returns all configured attributes for a
ch5 component
-
getTemplateVarsForElement(cr:Ch5Common):TCh5ConfigTemplateVars[] returns all configured templatevariables
for a ch5 component
type TCh5ConfigAttributes={
[attrName:string]: string
}
type TCh5ConfigTemplateVars={
[varName:string]: string
}
type TCh5Config={
"attributes": {
"id": {
[id:string]:TCh5ConfigAttributes
},
"component": {
[component:string]:TCh5ConfigAttributes
}
},
"templatevariables": {
"id": {
[id:string]:TCh5ConfigTemplateVars[]
}
}
}