AngularJS在事件中设置属性等待$ Http

时间:2018-02-06 07:52:04

标签: angularjs ajax wijmo

我使用的是wijmo angularjs treeview

我希望能够根据$ http请求的结果在已触发事件中设置属性,但事件完成触发

     $scope.Drop = function (s, e) {            
        $http({
            url: NavMenuSelectionFac.AjaxURL("DeviceInstance/DeviceInstance/MoveDeviceInstance"),
            cache: false,
            method: 'POST',
            data: { "deviceInstanceToMove": e._src.dataItem, "NewParentPK": e._tgt.dataItem.pk },
            responseType: 'JSON',
        }).then(function (response) {
            if (response.data.Result === 1) {
                Notification.success(response.data.Message);  
                e.cancel = false;
                //This needs to be set based off the result of the http request
            }
            else {
                Notification.error(response.data.Message);
                e.cancel = true;

            }
        }, function (response) {
            //TODO : Something here
        });
    };

0 个答案:

没有答案