nutritionLabel.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * An element which displays USDA nutrition-style label.
  3. */
  4. (function() {
  5. (function() {
  6. try {return angular.module('ieat.ui')}
  7. catch {return angular.module('ieat.ui', [])}}
  8. )().component('nutritionLabel', {
  9. templateUrl: 'static/templates/nutritionLabel.html',
  10. bindings: {
  11. /* Food containing nutritional information */
  12. food: '<',
  13. },
  14. controller: ['$scope', function($scope) {
  15. var self = this;
  16. this.$onInit = function() {
  17. $scope.food = self.food;
  18. };
  19. $scope.calories_in_fat = 8.84;
  20. $scope.daily = {
  21. 204: 78, // Total Fat
  22. 606: 20, // Saturated Fat
  23. 601: 300, // Cholesterol
  24. 307: 2300, // Sodium
  25. 205: 275, // Total Carbohydrates
  26. 291: 28, // Dietary Fiber
  27. 320: 800, // Vitamin A (900 M, 700 F)
  28. 415: 1.15 + 1.2 + 15 + 1.3 + 2.4 + 5, // Vitamin B
  29. 401: 88, // Vitamin C (90 M, 75 F)
  30. 324: 15, // Vitamin D
  31. 301: 1300, // Calcium
  32. 303: 13, // Iron (8 M, 18 F)
  33. 306: 4700, // Potassium
  34. 432: 400, // Folate
  35. };
  36. }]
  37. });
  38. })();