$ scope变量更改在视图

时间:2015-12-21 12:06:47

标签: javascript jquery html angularjs

我将响应数据分配给$ scope.ShippingCharges,但它不会立即对视图产生影响。



$scope.selectedAddress = function(ID)
    {
        $.ajax({
            type: "GET",
            url: "http://localhost:49917/ShoppingCart/CalculateShipping",
            dataType: "json",
            data: { 'Id': ID },
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                if (data != null) {
                    $scope.ShippingCharges = data;
                }
            },
            error: function (e) {
                console.log(e);
            }
        });
   }

<p style="margin:0"><span ng-bind="ShippingCharges"></span></p>
&#13;
&#13;
&#13;

0 个答案:

没有答案