0
エラーを処理するためにhttpインターセプタを使用しています。いくつかの特定のエラーがキャプチャされたら、エラーメッセージを表示するウィンドウをポップアップするためにmd-dialogを使用することは可能ですか?サービスに$mdDialog
を注入すると、エラーcircular dependency
が発生します。このサービスで$mdDialog
を使用することができます場合、私はどこにバインドする必要がありますerrorMsg
?
インターセプター:
.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