A solution I've found, although it doesn't feel like the right one is the
following:
thisModule.provider('possiblyNullProvider', function
possiblyNullProvider() {
this.$get = function() { return null; };
});
Wrap this in a conditional that will set this if there is if the provider
is not to be expected and place it before thisModule.controller.
On Monday, June 29, 2015 at 1:49:18 PM UTC-5, Brett Jackson wrote:
>
> Is it possible to catch and ignore the $injector:unpr exception? I have a
> case where a provider is created by using resolve in angular-ui's modal.
> However, the controller that is launched by this modal isn't always called
> as a modal, it is loaded by just navigating to that route. In this case,
> the provider is not defined.
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.