已经写了有两个 view function 可以处理 follow, unfollow 。然后点击 button 触发 ajax 吗?
1
Moker 2015-12-02 09:04:19 +08:00 1
点击 follow 如果关注成功 更改 button 的值 如果不成功给出相应提示
取消关注同理 |
4
answeryou 2015-12-02 10:20:18 +08:00 1
vm.follow = function() {
} |
5
answeryou 2015-12-02 10:25:33 +08:00
vm.follow = function() {
vm.abled = false; var promise = goFollow(); promise.then(function (res) { vm.abled = true; }, function () { }); }; function goFollow() { var deferred = $q.defer(); $http.post('xxx', param).then(function (response) { if (response.code === 200) { deferred.resolve(response); } }); return deferred.promise; } |
6
lbfeng OP |