क्या कोई जानता है कि आप यह देखने के लिए कैसे जांच सकते हैं कि AngularJS में संसाधन लाने में विफल रहा है?AngularJS विफल संसाधन
उदाहरण के लिए:
//this is valid syntax
$scope.word = Word.get({ id : $routeParams.id },function() {
//this is valid, but won't be fired if the HTTP response is 404 or any other http-error code
});
//this is something along the lines of what I want to have
//(NOTE THAT THIS IS INVALID AND DOESN'T EXIST)
$scope.word = Word.get({ id : $routeParams.id },{
success : function() {
//good
},
failure : function() {
//404 or bad
}
});
कोई भी विचार?
बिल्कुल सही। यह ठीक वैसा ही है जैसा मुझे चाहिए। धन्यवाद :) – matsko
समस्या अगर कथन में है। क्या मुझे लिखना है (reponse.status == 404), अगर (reponse.status == 500), अगर (reponse.status == 501), अगर .. अगर .. अगर? क्या यह कोड डुप्लिकेशन नहीं है – Adelin
@Adio आप एक स्विच स्टेटमेंट का उपयोग कर सकते हैं। –