Czesc potrzebuje pomocy z asynchronicznoscia. Otoz mam taki kod.
.when('/main',{
templateUrl: 'client/templates/main.html',
controller: "mainctr as vm",
resolve:{
checkStatus:checkStatus
}
})
function checkStatus($q,$location,Status,$injector){
$injector.get('Status').someAsync().then(function(data){
console.log(data)
},function(err){
console.log(err);
});
}
someAsync:function(){
var deferred = $q.defer();
if(checkStatus.hasOwnProperty('status')){
deferred.resolve('aktualny status to');
}else{
deferred.reject('brak statusu');
}
return deferred.promise;
}
Wszystko dziala okej, jesli wejde w link klikajac w niego, gorzej jesli zrobie refresh na tej danej stronie/podstronie. Probowalem roznych sposobow asynchronicznosci ale cos mi nie wychodzi. Mial ktos kiedys podobny problem?