相关疑难解决方法(0)

你是否需要在$ scope $ destroy事件中取消绑定$ scope.$ on?

我有使用$ 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)

javascript angularjs

10
推荐指数
1
解决办法
3406
查看次数

标签 统计

angularjs ×1

javascript ×1