You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be beneficial to have access to the nsRouterLinkActive directive reference, so that we can access helper functions like isActive.
The use case I am currently stuck in, is trying to eliminate UIView containers in NativeScript. My navigation bar is a custom element that iterates and creates icon buttons. Due to how the views are constructed, we have to place the nsRouterLinkActive on the parent container iterating, otherwise it's not registered.
Our application then has custom branding that injects CSS to overwrite the router links default styling.
Currently I have no "neat" way of accessing if the router link is active or not, besides writing a helper function to check the URL agains the router link I'm passing in.
Desired Code Example:
<app-navbar-item *ngFor="let link of userLinks"
[nsRouterLinkActive]="['active']"
[nsRouterLink]="link.menuLink"
#rla="nsRouterLinkActive"
[active]="rla.isActive"
[item]="link"></app-navbar-item>
This would most likely require a small refactor in the nsRouterLinkActive implementation, as I see you are assigning isActiveLinks in a local reference to a function's scope.
@sean-perkins exportAs was added to routerLinkActive some months after it was initially introduced. We simply haven't updated the NS version of the directive. As you pointed out, the fix should be relatively simple. If you have the time to make a PR, we'll be happy to merge it. :)
Activity
sis0k0 commentedon Aug 4, 2017
@sean-perkins
exportAswas added to routerLinkActive some months after it was initially introduced. We simply haven't updated the NS version of the directive. As you pointed out, the fix should be relatively simple. If you have the time to make a PR, we'll be happy to merge it. :)feat: add `exportAs` logic for `isActive` on `routerLinkActive` direc…