Creating a custom component - hslayers/hslayers-ng GitHub Wiki

Word of warning: written by a novice after trial and error! To be considered a guide more by a dummy than for dummies.

Creating a component

Creating a new component starts off by creating a new sub-folder in the folder components.

  1. The folder name should be alphanumeric a-z0-9 and reflect the name of the component
  2. The folder should include a JavaScript file with the same name as the folder
  3. The folder should contain a sub-folder called 'partials' for storing HTML page-templates etc.
  4. The component path should be added to the hslayers.js file of your HSLayers NG instance
  5. The component must be registered in the app.js file of your HSLayers NG instance
    • By instance in points 4 and 5, is meant the root folder of an application, i.e. any of the sub-folders under the 'examples/' catalog

Creating a new panel in the side-menu

The visibility of the menu items relies on whether or not the components controller has been loaded and on the selected panel keyword.

  • The desired menu item must be added to the file 'components/sidebar/partials/sidebar.html'
    • See other menu items in that file for syntax
  • The panel item to be loaded must be added to the file 'hslayers.html' on the root
    • Once again, see other menu items in that file for syntax