Skip to content

Commit

Permalink
category changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Salisbury committed Apr 19, 2017
1 parent 7ea20af commit 7524aa5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var app = angular.module('app', ['ngRoute', 'ngResource', 'ngCookies']);
// Factories

app.factory('Foods', function($resource) {
return $resource('http://foodbank.develop.digitalmediauconn.org/api/food/all');
return $resource('api/food/all');
// return $resource('assets/json/foods.json');
});

Expand All @@ -17,11 +17,11 @@ app.factory('FoodDetail', function($resource) {
});

app.factory('Categories', function($resource) {
return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/category/all');
return $resource('api/index.php/category/all');
});

app.factory('Nutrients', function($resource) {
return $resource('http://foodbank.develop.digitalmediauconn.org/api/index.php/nutrient/all');
return $resource('api/index.php/nutrient/all');
});

// Just does a PUT request when u call Food.update
Expand Down
13 changes: 8 additions & 5 deletions app/pages/categories/ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ app.controller('CategoryCtrl', ['$scope', '$http', 'Categories', 'Nutrients', fu


// GET list of categories
Categories.get({}, function (data) {
$scope.categories = data.data;
Categories.get().$promise.then(function(response){
$scope.categories = response.data;
;
});

$scope.ranks = GetRanks();

$scope.units = ['mg', 'g'];

Nutrients.get({}, function(data) {
$scope.nutrients = data.data;
});
Nutrients.get().$promise.then(function(response){

$scope.nutrients = response.data;


});
$scope.operations = GetOperations();


Expand Down
8 changes: 4 additions & 4 deletions app/pages/categories/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<div class="card-content">
<div class="row">
<div class="col s6">
<select ng-model="rule.nutrientId">
<option ng-repeat="nutrient in nutrients" value="{{nutrient.id}}" ng-selected="nutrient.id==rule.nutrientId">{{nutrient.name}}</option>
<select ng-model="rule.nutrientId" ng-options="nutrient.id as nutrient.name for nutrient in nutrients">
<!-- <option ng-repeat="nutrient in nutrients" value="{{nutrient.id}}" ng-selected="nutrient.name==rule.nutrientName">{{nutrient.name}}</option> -->
</select>
</div>
<div class="col s6">
<select ng-model="rule.rank">
<option ng-repeat="rank in ranks" value="{{rank.id}}" ng-selected="rule.rank == rank.id">{{ rank.name }}</option>
<select ng-model="rule.rank" ng-options="rank.id as rank.name for rank in ranks">
<!-- <option ng-repeat="rank in ranks" value="{{rank.id}}" ng-selected="rule.rank == rank.id">{{ rank.name }}</option> -->
</select>
</div>
<div class="col s4">
Expand Down

0 comments on commit 7524aa5

Please sign in to comment.