我有使用$ on绑定事件的指令我是否需要在范围被销毁时删除该绑定,还是自动完成?我还需要调用$ 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();
});
}
};
Run Code Online (Sandbox Code Playgroud)