| 1234567891011121314151617181920212223242526272829303132333435 |
- /**
- * A pane that displays/edits basic food objects
- */
- (function() {
- (function() {
- try {return angular.module('ieat.ui.editors')}
- catch {return angular.module('ieat.ui.editors', ['ndbDatabase','Units'])}}
- )().component('basicFoodEditor', {
- templateUrl: 'static/templates/basicFoodEditor.html',
- bindings: {
- ndbKey: '@',
- food: '<'
- },
- controller: [
- '$scope', 'NDBList', 'Unit', function($scope, NDBList, Unit) {
- var self = this;
- $scope.units_symbol = {};
- Unit.primary(function(units) {
- units.forEach(function(elm) {
- $scope.units_symbol[elm.type] = elm.symbol;
- });
- });
- this.$onInit = function() {
- $scope.categories = NDBList.get({
- key: self.ndbKey,
- type: "g"
- });
- if (!self.food.unit_type) {
- self.food.unit_type = "Mass";
- self.food.dry = true;
- }
- };
- }]
- });
- })();
|