MemberDetailedComponet
@ViewChild('memberTabs', { static: false }) memberTabs: TabsetComponent;
ngOnInit() {
/* get thr routes tab parameter */
this.route.queryParams.subscribe(params => {
// tslint:disable-next-line: no-string-literal
const selectTab = +params['tab'];
console.log('queryparams:' + selectTab);
this.memberTabs.tabs[selectTab > 0 ? selectTab : 0].active = true;
});
}
selectTab(tabId: number) {
this.memberTabs.tabs[tabId].active = true;
}
在routerlink中
[routerLink]="['/members']"[queryParams]="{ tab: 3 }"
尽管selectTab读取该值,但在控制台中显示未定义的标签
答案 0 :(得分:0)
将 { static: false}
替换为 { static: true }
。