$scope.getdetail = function() {
// 通过$watch currentPage和itemperPage 当他们一变化的时候,重新获取数据条目
$scope.$watch('paginationConf.currentPage + paginationConf.itemsPerPage', reGetProducts('1'));
$("#BigDiv").css({ display: "block", height: $(document).height(), width: $(document).width() });
$('#turemoney_detail').css("display", "block");
}
reGetProducts如果不加括号不写参数的话,在变化的时候就能自动执行,但是传递参数后就无法
正常执行了,能解决吗?
因为$watch本身的第二个参数是一个函数:
function(newVal, oldVal){}
,当按照你的的方式传递参数之后,就成了函数返回值,当然后面就无法正常执行了。如果非要传递参数,那么可以使用