问题描述
$scope.paginationConf = {
currentPage: 1,itemsPerPage: 1 }; $scope.$watch(’paginationConf.currentPage + paginationConf.itemsPerPage’, $scope.reGetProducts); reGetProducts封装了请求函数,$watch用来监听页码的改变,当页码变动的时候会重新请求数据,现在只想在单击后才去调用. 但是页面加载后直接就执行了函数,
问题解答
回答1:$scope.reGetProducts = function (newValue, oldValue) { if (newValue === oldValue)return; //todo};