码迷,mamicode.com
首页 > 其他好文 > 详细

ng-alian 复用标签相关设置

时间:2018-08-15 18:37:17      阅读:615      评论:0      收藏:0      [点我收藏+]

标签:resolve   next   tab   设置   start   navig   any   syn   页面   

排除复用

import { ReuseTabMatchMode, ReuseTabService } from ‘@delon/abc‘;

export class StartupService {
    constructor(
        private reuseTabService: ReuseTabService,
        private inj: Injector) {
    }

    load(): Promise<any> {
        // only works with promises
        const pLoadData = new Promise(async (resolve, reject) => {
            // reuse-tab  是否重用页面,把这个页面排除了,所以只要跳转到别的页面 目标tab就会消失
            this.reuseTabService.mode = ReuseTabMatchMode.URL;
            const excludes = new Array<RegExp>();
            excludes.push(new RegExp(‘/target-route‘));
            this.reuseTabService.excludes = excludes;
            resolve({});
        });
        return pLoadData;
    }
}

参考资料

https://github.com/cipchk/ng-alain/issues/101

跳转关闭tab

this.router.navigateByUrl(`/target-route`,{
    skipLocationChange:true
});

skipLocationChange:Navigates without pushing a new state into history.
ng-alain的tab根据路由的history生成=>tab没有关闭=生成了history=>要关闭tab,需要不保留history
关键词:angular 4 route navigate without pushing a new state into history.

参考资料

https://angular.io/api/router/NavigationExtras

ng-alian 复用标签相关设置

标签:resolve   next   tab   设置   start   navig   any   syn   页面   

原文地址:https://www.cnblogs.com/Lulus/p/9483030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!