unitEditor.js 758 B

123456789101112131415161718192021222324
  1. /**
  2. * A pane that displays/edits unit objects
  3. */
  4. (function() {
  5. (function() {
  6. try {return angular.module('ieat.ui.editors')}
  7. catch {return angular.module('ieat.ui.editors', ['ndbDatabase', 'Units'])}}
  8. )().component('unitEditor', {
  9. templateUrl: 'static/templates/unitEditor.html',
  10. bindings: {
  11. unit: '<'
  12. },
  13. controller: ['$scope', function($scope) {
  14. var self = this;
  15. $scope.unitTypes = ["Mass", "Volume", "Count"];
  16. $scope.addAlias = function(alias) {
  17. self.unit.aliases.push(alias);
  18. };
  19. $scope.deleteAlias = function(index) {
  20. self.unit.aliases.splice(index, 1);
  21. };
  22. }]
  23. });
  24. })();