Last active
August 29, 2015 14:27
-
-
Save coderbyheart/969779d0d924bc152d6a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source of this idea: https://angularjs.de/artikel/angularjs-browserify