Answers

Question and Answer:

  Home  AngularJS Developer

⟩ Explain me what is factory method?

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;

});

 225 views

More Questions for you: