【发布时间】:2017-03-20 04:06:37
【问题描述】:
实际上我正在关注一个春季教程..来到Angularjs,他正在使用.succes
var app=angular.module("MyApp",[]);
.controller("MyController",function($scope,$http){
$scope.pageProduits=null;
$http.get("http://localhost:8080/chercherProduits?mc")
.success(function(data){
$scope.pageProduits=data;
})
.error(function(err){
console.log(err);
});
});
现在我的问题是成功不起作用,经过搜索,我发现 .success 和 .error 方法已被弃用,并已从 AngularJS 1.6 中删除。我必须使用标准的 .then 方法。 有人可以使用 then 方法将现有代码转换为代码吗?我试过了,但我失败了,谁能帮助不熟悉 javaScript 的 plz bcz? 谢谢
【问题讨论】:
-
.then(response) => .catch(error) => .finally()
标签: angularjs angular-http angularjs-1.6