ensures more jquery event listeners are unbound

This commit is contained in:
Shannon
2015-07-31 12:52:29 +02:00
parent 0e4974babe
commit 612484c0b6
3 changed files with 14 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ angular.module("umbraco.directives")
$('a[data-toggle="tab"]').on('shown', update);
scope.$on('$destroy', function() {
$('a[data-toggle="tab"]').unbind("shown", update);
$('a[data-toggle="tab"]').off("shown", update);
});
};
});

View File

@@ -6,7 +6,8 @@
**/
angular.module("umbraco.directives.html")
.directive('detectFold', function ($timeout, $log, windowResizeListener) {
return {
return {
require: "^?umbTabs",
restrict: 'A',
link: function (scope, el, attrs) {
@@ -33,15 +34,14 @@ angular.module("umbraco.directives.html")
windowResizeListener.register(resizeCallback);
//TODO: Need to listen for tabs
$('a[data-toggle="tab"]').on('shown', function (e) {
calculate();
});
//Required for backwards compat for bootstrap tabs
$('a[data-toggle="tab"]').on('shown', calculate);
//ensure to unregister
scope.$on('$destroy', function() {
windowResizeListener.unregister(resizeCallback);
$('a[data-toggle="tab"]').off('shown', calculate);
});
}
};

View File

@@ -58,8 +58,14 @@ angular.module("umbraco")
});
});
$('a[data-toggle="tab"]').on('shown', function (e) {
var tabShown = function(e) {
google.maps.event.trigger(map, 'resize');
};
$('a[data-toggle="tab"]').on('shown', tabShown);
$scope.$on('$destroy', function () {
$('a[data-toggle="tab"]').off('shown', tabShown);
});
}