Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. /* The to be imported module */
  2. angular
  3. .module('myModule', [])
  4. .factory('myFactory', function () {
  5. var setting = null;
  6.  
  7. var myFactory = {
  8. initialize : initialize,
  9. action1 : action1,
  10. ...
  11. };
  12.  
  13. return myFactory;
  14.  
  15. function initialize(obj) {
  16. if (typeof setting == null) {
  17. setting = obj;
  18. }
  19. }
  20. });
  21.  
  22. /* Main app */
  23. angular
  24. .module('myApp', ['myModule'])
  25. .app(function(myFactory) {
  26. myFactory.initialize(someFile);
  27. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement