$http.get(...).then(...).error is not a function

1.6 新版本的AngularJs中用thencatch 代替了success和error,用PRomise规则。
更改写法:

1 $http.get('/api/user/showname2', {
2 
3 }).then(function (result) {
4   
5   alert(result.data);
6 
7 }).catch(function (result) {
8 
9 });

 

posted @ 2017-03-01 21:16  Mdreame  阅读(3913)  评论(0编辑  收藏  举报