Materia Client Assets
This repository contains all the javascript and css needed for the Materia Server and some assets needed for the Materia Widget Development Kit.
Visit the Materia Documentation for more information.
Conventions and Guidelines
Angular
- Each module is in it's own file, in a directory matching the type of module it is
- use dashes to seperate words in file names
- tests use the same name of the module they are testing (
module.js
and module.test.js
) - file names start with the type of module it is:
filter-
, dir-
, ctrl-
, srv-
- reusable code that has a wider scope then a single module is placed in a service module
Order of Code Angular Controllers
By convention, all controllers are written in a certain order from top to bottom:
- Variables and constants used in the controller
- Function defenitions, do define directly on $scope
- Expose variables and methods to $scope
- Initialize state
const app = angular.module('materia')
app.controller('peopleController', function($scope) {
let _people = []
const _sortNames = (a, b) => `${a.first} ${a.last}`.localeCompare(`${b.first} ${b.last}`)
const getPeople () => {
_people.sort(_sortNames)
$scope.people = _people
}
$scope.people = []
$scope.getPeople = getPeople
getPeople()
})