0
我使用http拦截器来处理错误。是否有可能使用MD对话框弹出一个窗口,显示错误消息,一旦捕获到某些错误。将$mdDialog
注入服务时发生circular dependency
错误。我应该在哪里绑定errorMsg
如果$mdDialog
可以用于此服务?
拦截:
.factory('httpInterceptor', ['$q', '$mdDialog', function($q, $mdDialog){
return {
'response': function(res) {
var status = res.data.status;
var errorMsg = res.data.payload.message;
if(status === 'fail') {
$mdDialog.show({
// controller: ???,
// scope: ???,
templateUrl: 'error.html',
})
return $q.reject(res);
}
return res;
}
}
}])
我认为他的问题是,如果他可以在角度为 –
的配置路径上声明的httpInterceptor中使用它,你已在'$ mdDialog.show()中有两次'controller'' – Phil
是@PauloGaldoSandoval – vincentf