Skip to content

Instantly share code, notes, and snippets.

@andrewhl
Created September 4, 2014 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewhl/145cf9edc93c1ac15975 to your computer and use it in GitHub Desktop.
Save andrewhl/145cf9edc93c1ac15975 to your computer and use it in GitHub Desktop.
'use strict';
var foodItemsCtrl = function ($scope, FoodItemService) {
$scope.test = FoodItemService.test();
}
module.exports = foodItemsCtrl;
'use strict';
var FoodItemService = function($http) {
return {
get : function() {
return $http.get('/api/food_item_templates');
},
test : function() {
return 'Foo';
}
}
}
module.exports = FoodItemService;
'use strict';
var angular = require('angular');
var foodItemService = require('./services/foodItemService');
var foodItemsCtrl = require('./controllers/foodItemsCtrl');
var app = angular.module('app', []);
app.factory('FoodItemService', ['$http', foodItemService]);
app.controller('foodItemsCtrl', ['$scope', foodItemsCtrl]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment