Adding a new view

From MMS Wiki
Jump to: navigation, search

We are using angular ui-router for views, which are called states for the router. A UI-router state has 3 basic components: the data (api call to server), the template (HTML), controller logic (JS) They need to be declared as a state in comp.js

  • Template (HTML)

Resides in client/app/views. Just add a new file there. Easiest to copy-paste a similar example and then rework the copy.

  • Controller (JS)

Should be in client/app/scripts/comparison/controllers. Again, copy-paste a similar example and work from there. For the .js to be included with the page, it needs to be added into client/app/build_blocks/comparison_js.html

  • API call

Server side apis reside in server/views/. Again, copy-paste an existing example Any new files there need to be added to server/views/ to be accessible

Adding new directives and services

For small directives and services, just add them to client/app/general/controllers/Snippets.js For larger ones, follow the same steps as above for JS, only put them to /directives or /services folder instead of /controllers. For directives with large html templates, use /views/misc folder for the template html