I have directive that bind event using $on do I need to remove that binding when scope is destroyed, or is it done automatically? Also do I need to call $element.off?
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.on('load', function() {
$element[0].contentWindow.focus();
});
$scope.$on('iframe:focus', function() {
$element[0].contentWindow.focus();
});
}
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…