Question - What is the factory function in AngularJS?
Answer -
For creating the directive, factory method is used. It is invoked only once when the compiler matches the directive for the first time. By using $injector.invoke the factory method is invoked.