Explain me what is factory method?

Submitted by: Muhammad
Using factory method, we first define a factory and then assign method to it.

var mainApp = angular.module("mainApp", []);
mainApp.factory('MathService', function() {
var factory = {};

factory.multiply = function(a, b) {
return a * b
}
return factory;
});
Submitted by: Muhammad

Read Online AngularJS Developer Job Interview Questions And Answers