From 4b1f1d3224fbf41b4e414b3193e183ea686365a8 Mon Sep 17 00:00:00 2001 From: jiazhong Date: Tue, 23 Dec 2014 15:54:37 +0800 Subject: [PATCH] fix watch in angular not work well issue when variable from undefined to true --- webapp/app/js/controllers/cubes.js | 5 ++++- webapp/app/js/controllers/job.js | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp/app/js/controllers/cubes.js b/webapp/app/js/controllers/cubes.js index 62a0472..d0ccd5d 100644 --- a/webapp/app/js/controllers/cubes.js +++ b/webapp/app/js/controllers/cubes.js @@ -28,7 +28,7 @@ KylinApp $scope.list = function (offset, limit) { if(!$scope.project.projects.length){ - return; + return []; } offset = (!!offset) ? offset : 0; limit = (!!limit) ? limit : 20; @@ -83,6 +83,9 @@ KylinApp }); $scope.reload = function () { // trigger reload action in pagination directive + if($scope.action.reload==undefined){ + $scope.action.reload = false; + } $scope.action.reload = !$scope.action.reload; }; diff --git a/webapp/app/js/controllers/job.js b/webapp/app/js/controllers/job.js index bd3e055..f89424d 100644 --- a/webapp/app/js/controllers/job.js +++ b/webapp/app/js/controllers/job.js @@ -93,6 +93,9 @@ KylinApp $scope.reload = function () { // trigger reload action in pagination directive + if($scope.action.reload==undefined){ + $scope.action.reload = false; + } $scope.action.reload = !$scope.action.reload; };