This creates one deferred for every ServiceChannel usage.
This means, that when you call MultiChannelsLoader
it will use the same promise each time.
A promise is an abstraction over a one time calculation. After it is resolved a promise can not change its state.
var d = $q.defer();
d.resolve("Foo"); // d will forever be remained in fulfilled state, with "Foo"
Imagine that resolve is implemented as:
resolve: function(){
if(pending){ // not resolved yet
pending = undefined; // change state to not pending.
}
}
Oh wait, it actually is. The promise specification is also crystal clear about this:
When fulfilled, a promise: must not transition to any other state. When rejected, a promise: must not transition to any other state.