It's often said that cyclic dependencies is a problem of design and it's true, but sometimes it's just simplier to deal with it. However some case make you have one specially if you don't have control over it.
I had once a circular dependecy : this was because of a configuration on $http interceptor which redirect toward login page using $state of ui-router. And ui-router has a dependency towards $http.
So if you're sure about what you're doing there is a couple of way
1- In myService constructor, call myFactory.setMyService(this).
2- Do a getter function in myService that will look for a field myFactoryif it's initialized. If not call $injector.get("myFactory");
3- For each function that need the cyclic dependcy : use an internal function defined like this :
this.toto = function(params){$injector.invoke(this.totoInternal, this, {params:params}};
this.totoInternal = ['params', 'myFactory' function(params, myFactory){...}]
4- In module.run function instantiate both service (without their dependcies) and set for each of them a field :
module.run(myService, myFactory){
myService.setMyFactory(myFactory);
myFactory.setMyService(myService);
}
Point 1 & 2 must be only done in one of them.
Point 3 has to be used in both/
Point 4 is setting dependecies before you'll need the actual service (hoping you don't need them in a module.run that would run before.
EDIT : about the 3rd party service that is used as mediator in the accepted answer -> i prefer using $injector as mediator. It's fair enough.