| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- angular.module('basicFoodEditor', ['ndbDatabase', 'ngResource', 'Food'])
- // TODO: Only ever used with editBasicFood template. See if can auto link.
- .controller('BasicFoodEditorController',
- ['$scope', '$uibModalInstance', 'NDBList', 'BasicFood', 'foodData', 'ndbKey',
- function($scope, $uibModalInstance, NDBList, BasicFood, foodData, ndbKey) {
- if (foodData == null)
- {
- console.error("No food data to edit!");
- return;
- }
- $scope.catagories = NDBList.get({
- key: ndbKey,
- type: "g"
- });
-
- $scope.food = foodData;
- $scope.submit = function(food) {
- food.$save($scope.close, function (err) {
- // TODO: Proper error handling
- console.error(err);
- });
- };
- $scope.delete = function(food) {
- food.$delete($scope.close, function (err) {
- // TODO: Proper error handling
- console.error(err);
- });
- };
- $scope.submit = function(food) {
- food.$save($scope.close, function (err) {
- // TODO: Proper error handling
- console.error(err);
- });
- };
- // TODO:
- // Will this controller ever be used non-modally?
- // Will it even work as a non-modal?
- $scope.close = $uibModalInstance != null?
- $uibModalInstance.close : null;
- $scope.dismiss = $uibModalInstance != null?
- $uibModalInstance.dismiss : null;
- }]);
|