這期內容當中小編將會給大家帶來有關怎么在angularjs中利用$http調用接口,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
如下所示:
$http.get("/merchantmall/merchant.json") .success(function(data, status, headers, config) { console.log(arguments); }) .error(function(data, status, headers, config) { console.log(arguments); })
$http({url: "/merchantmall/merchant.json", }) .success(function(data, status, headers, config) { console.log(arguments); }) .error(function(data, status, headers, config) { console.log(arguments); })
var promise = $http({ method: 'GET', url: '/api/users.json' }); promise.then(function(resp) { // resp是一個響應對象 }, function(resp) { // 帶有錯誤信息的resp });
var promise = $http({ method: 'GET', url: '/api/users.json' }); promise.success(function(data, status, headers, config) { // 處理成功的響應 }); promise.error(function(data, status, headers, config) { // 處理非成功的響應 });
上述就是小編為大家分享的怎么在angularjs中利用$http調用接口了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注創新互聯行業資訊頻道。
當前題目:怎么在angularjs中利用$http調用接口-創新互聯
標題來源:http://www.2m8n56k.cn/article2/cepcic.html
成都網站建設公司_創新互聯,為您提供網站導航、網站營銷、響應式網站、自適應網站、外貿建站、品牌網站設計
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯