-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepared Food Controller for proper JSON syntax
- Loading branch information
Gabe Rogan
committed
Feb 18, 2017
1 parent
68161f2
commit 8337f3e
Showing
11 changed files
with
390 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,38 @@ | ||
var app = angular.module('app', ['ngRoute', 'ngResource']); | ||
var app = angular.module('app', ['ngRoute', 'ngResource', 'ngCookies']); | ||
|
||
// Root controllers in /root/ folder | ||
// Page controllers in /pages/[your-page] folder | ||
|
||
// Factories | ||
|
||
// TODO: 'Foods' factory TEMPORARY | ||
app.factory('Foods', function($resource) { | ||
return $resource('assets/json/foods.json'); | ||
}); | ||
|
||
// Just does a PUT request when u call Food.update | ||
app.factory('Food', function ($resource) { | ||
// {food: '@id'} means replace :food with $scope.foodCRUD.id | ||
var data = $resource('http://foodbank.develop.digitalmediauconn.org/api/food/:food', {food: '@id'}, { | ||
update:{ method:'PUT' } | ||
}); | ||
return data; | ||
}); | ||
// app.factory('FoodDetail', function($resource) { | ||
// return $resource('assets/json/foodDetail.json'); | ||
// }); | ||
|
||
app.factory('Categories', function($resource) { | ||
return $resource('assets/json/categories.json'); | ||
}); | ||
|
||
// TODO: 'Nutrients' factory TEMPORARY | ||
app.factory('Nutrients', function($resource) { | ||
return $resource('assets/json/nutrients.json'); | ||
}); | ||
|
||
app.factory('Nutrient', function ($resource) { | ||
var data = $resource('http://foodbank.develop.digitalmediauconn.org/api/nutrients/:nutrient', {nutrient: '@id'}, { | ||
update:{ method:'PUT' } | ||
}); | ||
return data; | ||
}); | ||
// Just does a PUT request when u call Food.update | ||
// app.factory('Food', function ($resource) { | ||
// // {food: '@id'} means replace :food with $scope.foodCRUD.id | ||
// var data = $resource('http://foodbank.develop.digitalmediauconn.org/api/food/:food', {food: '@id'}, { | ||
// update:{ method:'PUT' } | ||
// }); | ||
// return data; | ||
// }); | ||
|
||
// app.factory('Nutrient', function ($resource) { | ||
// var data = $resource('http://foodbank.develop.digitalmediauconn.org/api/nutrients/:nutrient', {nutrient: '@id'}, { | ||
// update:{ method:'PUT' } | ||
// }); | ||
// return data; | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.