angular Js监听离开当前页面

使用 AngularJs-destroy事件 (页面离开事件)

在Controller中监听$destory事件,这个事件会在页面发生跳转的时候触发。

   /**
     * 监听是否离开页面
     */
    $scope.$on("$destroy", function() {
        //清除配置,不然scroll会重复请求
        $(".goodsStyle").css("height","");//离开页面时设置高度
    }),

猜你喜欢

转载自www.cnblogs.com/zhou-pan/p/10219625.html