在angularJs中显示下拉文本更改的数据

时间:2016-10-28 06:33:27

标签: javascript angularjs

我正在创建一个Web应用程序,当我选择了pageloads 1 default 2 Hotel/school 3 Date选项并显示sql记录时,我有一个下拉列表和3个选项(Default

现在,当用户从default更改为Hotel/school or Date,然后重新选择default我想显示网页加载记录

这是我在js

中所做的
//textchange to default
        if($scope.drd=="drd='Default'")
        {
            $scope.names = '';
            $scope.loadimage = true;
            $http.get('/csuv5.asmx/pageload', {
                params: {
                    log: log,
                    pm: pm
                }
            })

            .then(function (response) {
                $scope.loadimage = false;
                $scope.sonvinrpm = response.data.page;
                //pagination
                $scope.totalItems = $scope.sonvinrpm.length;
                $scope.numPerPage = 5;
                $scope.paginate = function (value) {
                    var begin, end, index;
                    begin = ($scope.currentPage - 1) * $scope.numPerPage;
                    end = begin + $scope.numPerPage;
                    index = $scope.sonvinrpm.indexOf(value);
                    return (begin <= index && index < end);
                };
                console.log(response.data.page);
            });
        };

关于如何做到这一点的任何想法?

1 个答案:

答案 0 :(得分:0)

<select ng-change="fetchData()" ng-model="drd">
    <option value="default">Default</option>
    <option value="holelSchool">Hotel/school</option>
    <option value="date">Date/school</option>
</select>

$ scope.fetchData()是$ http

的包装器