トークンが解決されない場合、すべての$ http要求を角で防止する方法を教えてください。 トークンが、私はあなたがすべての要求をインターセプトし、トークンが
angular.module('myModule', [])
.config(function($httpProvider) {
$httpProvider.interceptors.push(function($q) {
var canceler = $q.defer();
return {
'request': function(config) {
if(!window.localStorage.getItem('token')) {
config.timeout = canceler.promise; //cancelled
}
}
}
});
})
$ httpラッパー/プロキシを作成し、ポスト、ゲットなどのオーバーライドにチェックを入れてください。 – Igor