First page Back Continue Last page Graphics
Widgets
- Widgets are small, pre built gadgets to be used by Apps.
- To use a Widget in your App, you must add the path to the Widget in your dependencies list inside your default.js file.
- require(SIMRacingAppsRequireConfig,
['angular ', 'SIMRacingApps','css!default',
'widgets/CarNumber/CarNumber' ],
- Then add one or more elements to the DOM in your default.html file using the Widget’s name as the tag. Because HTML is not case sensitive, Angular requires you change from CamelCase to hyphens and you have to always prepend “sra-” to all Widget names as well.
- sraCarNumber in JavaScript becomes <sra-car-number></sra-car-number> in the HTML file.
- Widgets can also standalone and work as an App by itself. I have provided an App called WidgetLoader that takes “widget=WidgetName” as a parameter and runs it.
- For a complete list of Widgets, look in the “SRA_DIR\webapps\SIMRacingApps\widgets” folder or http://localhost/SIMRacingApps/widgets .