Provider '{0}' must define $get factory method.
This error occurs when attempting to register a provider that does not have a
$get
method. For example:
function BadProvider() {} // No $get method!
angular.module("myApp", [])
.provider('bad', BadProvider); // this throws the error
To fix the error, fill in the $get
method on the provider like so:
function GoodProvider() {
this.$get = angular.noop;
}
angular.module("myApp", [])
.provider('good', GoodProvider);
For more information, refer to the $provide.provider api doc.