Skip to content

Instantly share code, notes, and snippets.

@coderbyheart
Last active August 29, 2015 14:27
Show Gist options
  • Save coderbyheart/969779d0d924bc152d6a to your computer and use it in GitHub Desktop.
Save coderbyheart/969779d0d924bc152d6a to your computer and use it in GitHub Desktop.
// services/calculator.js
// contains a plain javascript object, which can be tested directly with mocha
var calculateResult = function (interest, duration, amount) {
return …
};
module.exports = {
calculateResult: calculateResult
};
// services/index.js
// wraps the services definitions
// See https://nodejs.org/api/modules.html#modules_folders_as_modules for why we use an index.js
var angular = require('angular');
angular.module('calculatorModule', []).factory('Calculator', [function () { return require('./calculator') }]);
// We then use browserify to build the app.js by resolving all require(…) calls
@coderbyheart
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment