My dependencies to be resolved rely on data which changes. How do you force angular to resolve dependencies again?
$routeProvider.
when('/blah', {
templateUrl: '/static/views/myView.html',
controller: 'myCtrl',
resolve: {
theData: function(myFactory) {
return myFactory.promise;
}
}
}).
i.e, every time this when
block is executed I want to re-resolve the dependency.
Is this trivial, or not so much?
Resolve block is rechecked every time route changes. In your case you need to return new promise each time, instead of how you are doing it currently. Looks like you cache and return always the same promise object.
resolve: {
theData: function(myFactory) {
return myFactory.getSomething();
}
}
Make myFactory.getSomething
return new promise in each invocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With