Optimize the click sensitivity of dashboard's sidebar menu (#268)

- Use AngularJS binding model directly rather than jQuery DOM-based operation
This commit is contained in:
cdfive 2018-11-29 10:37:09 +08:00 committed by Eric Zhao
parent 4f854c9eae
commit 0bc07f314e
1 changed files with 6 additions and 8 deletions

View File

@ -33,16 +33,14 @@ angular.module('sentinelDashboardApp')
// toggle side bar
$scope.click = function ($event) {
let element = angular.element($event.target);
let entry = angular.element($event.target).scope().entry;
entry.active = !entry.active;
entry.active = !entry.active;// toggle this clicked app bar
if (entry.active === false) {
element.parent().children('ul').hide();
} else {
element.parent().parent().children('li').children('ul').hide();
element.parent().children('ul').show();
}
$scope.apps.forEach(function (item) {// collapse other app bars
if (item != entry) {
item.active = false;
}
});
};
/**