当前位置 : 主页 > 网络编程 > JavaScript >

angular1获取city数据字典

来源:互联网 收集:自由互联 发布时间:2021-06-30
gistfile1.txt /portal/dictSelect.action?cateEname=ctyfatherValue=0$rootScope.dictTxtFun = function(cateEname,firstVal,secondVal,thirdVal){ var firstValue = "0"; var dictTxt = ""; if(secondVal!='' secondVal != null secondVal != undefined){ f
gistfile1.txt
/portal/dictSelect.action?cateEname=cty&fatherValue=0

$rootScope.dictTxtFun = function(cateEname,firstVal,secondVal,thirdVal){
    
    var firstValue = "0";
    var dictTxt = "";
    if(secondVal!='' && secondVal != null && secondVal != undefined){
        firstValue = firstVal;
    }
    dictService.loadDict(cateEname,firstValue)
        .then(function(res) {
        for (var i = 0; i < res.length; i++) {
            if (firstVal == res[i].id) {
                dictTxt = res[i].text;
            }
        }
    }).then(function(res){
        if(secondVal!='' && secondVal != null && secondVal != undefined){
            dictService.loadDict(cateEname,firstValue,secondVal)
                .then(function(res) {
                    for (var i = 0; i < res.data.length; i++) {
                        if (secondVal == res.data[i].id) {
                            dictTxt = dictTxt + res.data[i].text;
                        }
                    }
            })
        }
    }).then(function(res){
        if(thirdVal!='' && thirdVal != null && thirdVal != undefined){
            dictService.loadDict(cateEname,secondVal,thirdVal)
                .then(function(res) {
                    for (var i = 0; i < res.data.length; i++) {
                        if (thirdVal == res.data[i].id) {
                            dictTxt = dictTxt + res.data[i].text;
                        }
                    }
            })
        }
    })
    return dictTxt;
}
网友评论