如何将搜索模型传递给angular $ http.get

时间:2014-11-03 18:54:18

标签: angularjs

如何在不通过构建字符串

手动指定url的情况下执行此操作
var memberSearchModel = {
        SearchBy: "Name",
        SearchValue: "jaredites"

    };
    dataFactory.getMembers = function () {
        return $http.get(urlBase + '/' + memberSearchModel);
    };

1 个答案:

答案 0 :(得分:0)

第一个参数是url,第二个是数据:

var memberSearchModel = {
    SearchBy: "Name",
    SearchValue: "jaredites"

};
dataFactory.getMembers = function () {
    return $http.get(urlBase, memberSearchModel);
};

请参阅$http.get文档