function invokeFactory(factory, defaultVal) {
        var locals = {};
        locals[interimFactoryName] = publicService;
        return $injector.invoke(factory || function() { return defaultVal; }, {}, locals);
      }
Helper to call $injector.invoke with a local of the factory name for
this provider.
If an $mdDialog is providing options for a dialog and tries to inject
$mdDialog, a circular dependency error will happen.
We get around that by manually injecting $mdDialog as a local.