如何使用angularjs发布json数据?

时间:2015-06-13 07:11:10

标签: angularjs

我会尝试下面的逻辑,但它不起作用。

在Angular JS中:

    $scope.Save = function () {

    var items = $scope.invoice.items;
    var obj = [{ sMemberCode: 'ALMA0502' }];


    var request = $http({
        method: "post",
        url: sServiceURL + 'SaveData',
        data: obj
    });

};

在WCF服务中:

[OperationContract]

    [WebInvoke(UriTemplate = "SaveData",
        RequestFormat = WebMessageFormat.Json,
        ResponseFormat = WebMessageFormat.Json, Method = "POST")]
    bool SaveData(WcfService1.Common obj);

请告诉我我的错误......

1 个答案:

答案 0 :(得分:0)

试试这个

    @background(schedule=60)
    def get_score(self):
        p = self.likes+self.comments    # popularity
        t = (now()-self.date).total_seconds()/3600  # age_in_hrs
        # last_activity =
        n = self.admin_score
        score = (p/pow((t+1), 1.2))*n
        self.score = score
        return score

您是否在控制器中注入了$ http服务? 像这样:

{{1}}