Use jquery for resize binding

This commit is contained in:
Joe Fiorini 2015-01-26 13:58:22 -05:00
parent 6046419e2d
commit 64484c4054
4 changed files with 23 additions and 11 deletions

View File

@ -26,7 +26,7 @@
*
*/
function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, DashboardCounts, DashboardJobs,
ClearScope, Stream, Rest, GetBasePath, ProcessErrors, Button, graphData){
ClearScope, Stream, Rest, GetBasePath, ProcessErrors, Button, $window, graphData){
ClearScope('home');
@ -64,7 +64,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait,
e.html(html);
$compile(e)($scope);
waitCount = 4;
waitCount = 3;
loadedCount = 0;
if (!$routeParams.login) {
@ -83,10 +83,12 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait,
}
loadedCount++;
if (loadedCount === waitCount) {
$(window).resize(_.debounce(function() {
Wait('stop');
}, 500));
$(window).resize();
// console.log('binding to resize');
// angular.element($window).on('resize', _.debounce(function() {
// console.log('resize from controller');
// Wait('stop');
// }, 500));
// $(window).resize();
}
});
@ -170,7 +172,7 @@ function Home($scope, $compile, $routeParams, $rootScope, $location, $log, Wait,
}
Home.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'DashboardCounts', 'DashboardJobs',
'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', 'Button', 'graphData'
'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', 'Button', '$window', 'graphData'
];

View File

@ -12,10 +12,16 @@ angular.module('DashboardGraphs').
url = getBasePath('config');
$window.addEventListener('resize', function() {
angular.element($window).on('resize', function(e) {
if(!license_graph) return;
adjustGraphSize(license_graph, element);
});
element.on('$destroy', function() {
angular.element($window).off('resize', adjustGraphSize);
});
Rest.setUrl(url);
Rest.get()
.success(function (data){

View File

@ -29,10 +29,10 @@ angular.module('DashboardGraphs')
host_pie_chart.update();
}
$window.addEventListener('resize', adjustGraphSize);
angular.element($window).on('resize', adjustGraphSize);
element.on('$destroy', function() {
$window.removeEventListener('resize', adjustGraphSize);
angular.element($window).off('resize', adjustGraphSize);
});
function buildGraph(data) {

View File

@ -36,10 +36,14 @@ angular.module('DashboardGraphs')
var w = angular.element($window);
$window.addEventListener('resize', function() {
angular.element($window).on('resize', function() {
adjustGraphSize(job_status_chart, element);
});
element.on('$destroy', function() {
angular.element($window).off('resize', adjustGraphSize);
});
if (scope.removeGraphDataReady) {
scope.removeGraphDataReady();
}