Skip to content

Instantly share code, notes, and snippets.

@ketanghumatkar
Created March 20, 2015 05:43
Show Gist options
  • Save ketanghumatkar/4586d9715479c163c4c0 to your computer and use it in GitHub Desktop.
Save ketanghumatkar/4586d9715479c163c4c0 to your computer and use it in GitHub Desktop.
AngularJS Factory Snippet
// Factory can have another factory, $rootScope as dependancy but not $scope
Sample.factory('SampleFactory', ['$window', '$rootScope', 'AnotherFactory', function (_, $window, $rootScope, AnotherFactory) {
var factory = {}
factory.method1 = function() {};
factory.method2 = function() {};
return factory;
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment