首页 > 解决方案 > Nativescript 8 和 Angular 12 延迟加载 => nsRouterLinkActive 不添加活动类

问题描述

我正在将一个项目从 NS 6.5 与 Angular 8.2 迁移到 NS 8.1 和 Angular 12.2 我遇到了 nsRouterLinkActive 指令的问题,该指令不起作用。我正在为我的模块使用延迟加载,就像这样

{ path: "mysettings", loadChildren: () => import("~/app/mysettings/mysettings.module").then((m) => m.MysettingsModule) }

然后在我的 app.component 中,我使用以下代码进行导航:

<Label text="&#xf011;" class="fas bottomButton" [nsRouterLink]="['/mysettings']" nsRouterLinkActive="active" pageTransition="slide"></Label>

导航工作正常,我的课程工作正常,但它从未被 nsRouterLinkActive 指令添加。有什么帮助吗?

标签: nativescriptnativescript-angular

解决方案


不尝试但查看文档,不应该nsRouterLinkActive 也用方括号括起来,即[nsRouterLinkActive]


推荐阅读